Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

c# I'm getting an error for the following chunk of code public void FlipCard(Sprite startImage, Sprite endImage, int cardIndex) { StopCoroutine (Flip(startImage, endImage, cardIndex)); StartCoroutine

c#

I'm getting an error for the following chunk of code

public void FlipCard(Sprite startImage, Sprite endImage, int cardIndex) { StopCoroutine (Flip(startImage, endImage, cardIndex)); StartCoroutine (Flip(startImage, endImage, cardIndex)); }

Error is Argument 1: cannot convert from 'System.Collections.IEnumerable' to'System.Collections.IEnumerable'

Here's the who java class:

using System.Collections; using System; using System.Collections.Generic; using UnityEngine;

public class CardFlipper : MonoBehaviour { SpriteRenderer spriteRenderer; CardModel model;

public AnimationCurve scaleCurve; public float duration = 0.5f;

void Awake() { spriteRenderer = GetComponent(); model = GetComponent(); }

public void FlipCard(Sprite startImage, Sprite endImage, int cardIndex) { StopCoroutine (Flip(startImage, endImage, cardIndex)); StartCoroutine (Flip(startImage, endImage, cardIndex)); }

IEnumerable Flip(Sprite startImage, Sprite endImage, int cardIndex) { spriteRenderer.sprite = startImage;

float time = 0f; while (time <= 1f) { float scale = scaleCurve.Evaluate(time); time = time + Time.deltaTime / duration;

Vector3 localScale = transform.localScale; localScale.x = scale; transform.localScale = localScale;

if (time >= 0.5f) { spriteRenderer.sprite = endImage; }

yield return new WaitForFixedUpdate(); }

if (cardIndex == -1) { model.ToggleFace(false); } else { model.cardIndex = cardIndex; model.ToggleFace(true); } } }

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions