Пример #1
0
    // Update is called once per frame
    void Update()
    {
        currentTime += Time.deltaTime;
        switch (state)
        {
        case State.wait:
            if (currentTime >= waitTime)
            {
                state = State.jump;
                pathFollower.Resume(isFlipped);
                spriteAnim.Resume();
                currentTime = 0;
            }
            break;

        case State.jump:
            if (currentTime >= jumpTime)
            {
                state     = State.wait;
                isFlipped = !isFlipped;
                pathFollower.Pause();
                spriteAnim.Pause();
                currentTime = 0;
            }
            break;
        }
    }
Пример #2
0
 void CombinedEnter()
 {
     SfxManager.instance.PlaySound(SoundType.SLIME_COMBINE);
     animator.Pause();
     this.currentWobbleIntensity = wobbleIntensity;
     this.currentWobbleSpeed     = wobbleSpeed;
 }
Пример #3
0
 public Lunger(Texture2D spritesheet, Rectangle hitbox, List<Vector2> hitPolyPoints, Vector2 hitboxoffset)
     : base(spritesheet, hitbox, hitPolyPoints, hitboxoffset)
 {
     _idleAnim = new SpriteAnim(spritesheet, 5, 6, 16, 16, 100, new Vector2(8, 8), false, false, 0);
     _idleAnim.Pause();
     _hitAnim = new SpriteAnim(spritesheet, 11, 6, 16, 16, 100, new Vector2(8, 8), false, false, _idleAnim.CurrentFrame);
     _hitAnim.Pause();
 }
Пример #4
0
 public Lunger(Texture2D spritesheet, Rectangle hitbox, List <Vector2> hitPolyPoints, Vector2 hitboxoffset)
     : base(spritesheet, hitbox, hitPolyPoints, hitboxoffset)
 {
     _idleAnim = new SpriteAnim(spritesheet, 5, 6, 16, 16, 100, new Vector2(8, 8), false, false, 0);
     _idleAnim.Pause();
     _hitAnim = new SpriteAnim(spritesheet, 11, 6, 16, 16, 100, new Vector2(8, 8), false, false, _idleAnim.CurrentFrame);
     _hitAnim.Pause();
 }
Пример #5
0
        public Gorger(Texture2D spritesheet, Rectangle hitbox, List <Vector2> hitPolyPoints, Vector2 hitboxoffset)
            : base(spritesheet, hitbox, hitPolyPoints, hitboxoffset)
        {
            _idleAnim = new SpriteAnim(spritesheet, 3, 6, 16, 16, 100, new Vector2(8, 8), false, false, 0);
            _idleAnim.Pause();
            _hitAnim = new SpriteAnim(spritesheet, 9, 6, 16, 16, 100, new Vector2(8, 8), false, false, _idleAnim.CurrentFrame);
            _hitAnim.Pause();

            Speed.Y = Helper.RandomFloat(-0.2f, 0.2f);
        }
Пример #6
0
        public Gorger(Texture2D spritesheet, Rectangle hitbox, List<Vector2> hitPolyPoints, Vector2 hitboxoffset)
            : base(spritesheet, hitbox, hitPolyPoints, hitboxoffset)
        {
            _idleAnim = new SpriteAnim(spritesheet, 3, 6, 16, 16, 100, new Vector2(8, 8), false, false, 0);
            _idleAnim.Pause();
            _hitAnim = new SpriteAnim(spritesheet, 9, 6, 16, 16, 100, new Vector2(8, 8), false, false, _idleAnim.CurrentFrame);
            _hitAnim.Pause();

            Speed.Y = Helper.RandomFloat(-0.2f, 0.2f);
        }
Пример #7
0
        public Flyer(Texture2D spritesheet, Rectangle hitbox, List<Vector2> hitPolyPoints, Vector2 hitboxoffset)
            : base(spritesheet, hitbox, hitPolyPoints, hitboxoffset)
        {
            _idleAnim = new SpriteAnim(spritesheet, 0, 1, 16, 16, 100, new Vector2(8, 8), false, false, 0);
            _idleAnim.Pause();
            _hitAnim = new SpriteAnim(spritesheet, 6, 1, 16, 16, 100, new Vector2(8, 8), false, false, _idleAnim.CurrentFrame);
            _hitAnim.Pause();

            _faceDir = Helper.Random.Next(2) == 0 ? -1 : 1;

            gunLoop = AudioController.CreateInstance("minigun");
            gunLoop.IsLooped = true;
            gunLoop.Volume = 0f;
            gunLoop.Play();
            gunLoop.Pause();
        }
Пример #8
0
        public Flyer(Texture2D spritesheet, Rectangle hitbox, List <Vector2> hitPolyPoints, Vector2 hitboxoffset)
            : base(spritesheet, hitbox, hitPolyPoints, hitboxoffset)
        {
            _idleAnim = new SpriteAnim(spritesheet, 0, 1, 16, 16, 100, new Vector2(8, 8), false, false, 0);
            _idleAnim.Pause();
            _hitAnim = new SpriteAnim(spritesheet, 6, 1, 16, 16, 100, new Vector2(8, 8), false, false, _idleAnim.CurrentFrame);
            _hitAnim.Pause();

            _faceDir = Helper.Random.Next(2) == 0 ? -1 : 1;

            gunLoop          = AudioController.CreateInstance("minigun");
            gunLoop.IsLooped = true;
            gunLoop.Volume   = 0f;
            gunLoop.Play();
            gunLoop.Pause();
        }
Пример #9
0
        public Ship(Texture2D spritesheet, Rectangle hitbox, List <Vector2> hitPolyPoints, Vector2 hitboxoffset)
            : base(spritesheet, hitbox, hitPolyPoints, hitboxoffset)
        {
            Instance = this;

            engineLoop          = AudioController.CreateInstance("boost");
            engineLoop.Volume   = 0f;
            engineLoop.IsLooped = true;
            engineLoop.Play();
            engineLoop.Pause();
            engineLoop.Volume = 0.3f;
            gunLoop           = AudioController.CreateInstance("minigun");
            gunLoop.IsLooped  = true;
            gunLoop.Volume    = 0f;
            gunLoop.Play();
            gunLoop.Pause();
            gunLoop.Volume   = 0.3f;
            hitLoop          = AudioController.CreateInstance("shiphit");
            hitLoop.IsLooped = false;
            hitLoop.Volume   = 1f;


            _idleAnim = new SpriteAnim(spritesheet, 0, 1, 16, 16, 100, new Vector2(8, 8));
            _idleAnim.Play();
            _upAnim = new SpriteAnim(spritesheet, 1, 2, 16, 16, 500, new Vector2(8, 8), false, false, 0);
            _upAnim.Pause();
            _downAnim = new SpriteAnim(spritesheet, 2, 2, 16, 16, 500, new Vector2(8, 8), false, false, 0);
            _downAnim.Pause();

            _idleHitAnim = new SpriteAnim(spritesheet, 3, 1, 16, 16, 100, new Vector2(8, 8));
            _idleHitAnim.Play();
            _upHitAnim = new SpriteAnim(spritesheet, 4, 2, 16, 16, 500, new Vector2(8, 8), false, false, 0);
            _upHitAnim.Pause();
            _downHitAnim = new SpriteAnim(spritesheet, 5, 2, 16, 16, 500, new Vector2(8, 8), false, false, 0);
            _downHitAnim.Pause();

            Active = true;
        }
Пример #10
0
        public Ship(Texture2D spritesheet, Rectangle hitbox, List<Vector2> hitPolyPoints, Vector2 hitboxoffset)
            : base(spritesheet, hitbox, hitPolyPoints, hitboxoffset)
        {
            Instance = this;

            engineLoop = AudioController.CreateInstance("boost");
            engineLoop.Volume = 0f;
            engineLoop.IsLooped = true;
            engineLoop.Play();
            engineLoop.Pause();
            engineLoop.Volume = 0.3f;
            gunLoop = AudioController.CreateInstance("minigun");
            gunLoop.IsLooped = true;
            gunLoop.Volume = 0f;
            gunLoop.Play();
            gunLoop.Pause();
            gunLoop.Volume = 0.3f;
            hitLoop = AudioController.CreateInstance("shiphit");
            hitLoop.IsLooped = false;
            hitLoop.Volume = 1f;

            _idleAnim = new SpriteAnim(spritesheet, 0, 1, 16, 16, 100, new Vector2(8, 8));
            _idleAnim.Play();
            _upAnim = new SpriteAnim(spritesheet, 1, 2, 16, 16, 500, new Vector2(8, 8), false, false, 0);
            _upAnim.Pause();
            _downAnim = new SpriteAnim(spritesheet, 2, 2, 16, 16, 500, new Vector2(8, 8), false, false, 0);
            _downAnim.Pause();

            _idleHitAnim = new SpriteAnim(spritesheet, 3, 1, 16, 16, 100, new Vector2(8, 8));
            _idleHitAnim.Play();
            _upHitAnim = new SpriteAnim(spritesheet, 4, 2, 16, 16, 500, new Vector2(8, 8), false, false, 0);
            _upHitAnim.Pause();
            _downHitAnim = new SpriteAnim(spritesheet, 5, 2, 16, 16, 500, new Vector2(8, 8), false, false, 0);
            _downHitAnim.Pause();

            Active = true;
        }
Пример #11
0
        // Use this for initialization
        void Start()
        {
            //
            if( m_MoveDir.x != 1 && m_MoveDir.y != 1 && m_MoveDir.z != 1 &&
               m_MoveDir.x != -1 && m_MoveDir.y != -1 && m_MoveDir.z != -1 )
            {
                Debug.LogWarning( "The MoveDir is invalid. Set it to default.", this );
                m_MoveDir = Vector3.right;
            }

            UIEventTrigger trigger = this.transform.GetComponent<UIEventTrigger>();

            if(trigger == null)
            {
                trigger = this.gameObject.AddComponent<UIEventTrigger>();
            }

            EventDelegate.Add(trigger.onHoverOver,this.OnHoverIn);
            EventDelegate.Add(trigger.onHoverOut,this.OnHoverOut);

            m_SpriteAnim = this.GetComponent<SpriteAnim>();

            if( m_SpriteAnim == null )
                Debug.LogWarning( "This GameObject has not Component:'SpriteAnim'.", this );
            else
                m_SpriteAnim.Pause();

            //
            StartCoroutine( DelayInit() );
        }