public Snake(int x, int y) { Weight = 100; Behavior = new SnakeBehavior(); Behavior.Initialize(this); Texture = ContentHelper.LoadTexture("Enemies/snake"); SetPosition(new Vector2(x, y)); CollRectangle = new Rectangle(0, 0, 32 * 2, 48 * 2); SourceRectangle = new Rectangle(0, 0, 32, 48); _complexAnimation.AddAnimationData("still", new ComplexAnimData(1, Texture, new Rectangle(0, 0, 32, 48), 0, 32, 48, 125, 8, true)); _complexAnimation.AddAnimationData("attack", new ComplexAnimData() { Priority = 1000, Texture = Texture, DeltaRectangle = new Rectangle(0, 0, 32, 48), StartingY = SourceRectangle.Height * 1, Width = SourceRectangle.Width, Height = SourceRectangle.Height, Speed = 50, FrameCount = 8, IsRepeating = false, }); Sounds.AddSoundRef("idle", "Sounds/Snake/snake_idle"); Sounds.AddSoundRef("spit", "Sounds/Snake/snake_spit"); Sounds.AddSoundRef("death", "Sounds/Snake/snake_death"); }
void LateUpdate() { flag = snake.GetComponent <SnakeBehavior>(); if (flag.ifAlive) { Move(); } }
// Use this for initialization void Start() { m_Player = FindObjectOfType <SnakeBehavior>(); }
void Start() { Instance = this; swipeArea = GameObject.Find("SnakeSwipeArea").GetComponent <SwipeDetection>(); }