/// <summary> /// Returns the index of the lane that needs to be spawned /// </summary> /// <param name="forward"></param> /// <returns></returns> int SpawnIndex(bool forward) { FrogBehavior frogBehavior = _frogs[0].GetComponent <FrogBehavior>(); if (forward) { return(frogBehavior.YRelative - YMin + LanesVisible()); } return(frogBehavior.YRelative - YMin - 1); }
public Frog(int x, int y) { Weight = 90; Behavior = new FrogBehavior(); Behavior.Initialize(this); Texture = ContentHelper.LoadTexture("Enemies/frog"); SetPosition(new Vector2(x, y)); CollRectangle = new Rectangle(0, 0, 32, 32); SourceRectangle = new Rectangle(0, 0, 24, 32); _complexAnimation.AddAnimationData("still", new ComplexAnimData(1, Texture, new Rectangle(4, 16, 24, 32), 0, 24, 32, 125, 4, true)); _complexAnimation.AddAnimationData("jump", new ComplexAnimData(100, Texture, new Rectangle(4, 16, 24, 32), 32, 24, 32, 50, 4, false)); Sounds.AddSoundRef("jump", "Sounds/Frog/frog_jump"); Sounds.AddSoundRef("idle", "Sounds/Frog/frog_croak"); }
void Start() { frog = GameObject.FindWithTag("Player").GetComponent <FrogBehavior>(); }