Question
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
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
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started