Ejemplo n.º 1
0
        // Initialization
        protected override void Initialization()
        {
            base.Initialization();

            Setup();
            MeleeColliderOn   = false;
            _lucyFlamethrower = GetComponent <LucyFlamethrower>();
        }
Ejemplo n.º 2
0
        protected override void Colliding(Collider2D collider)
        {
            if (!this.isActiveAndEnabled)
            {
                return;
            }

            // if the object we're colliding with is part of our ignore list, we do nothing and exit
            if (_ignoredGameObjects.Contains(collider.gameObject))
            {
                return;
            }

            // if what we're colliding with isn't part of the target layers, we do nothing and exit
            if (!MMLayers.LayerInLayerMask(collider.gameObject.layer, TargetLayerMask))
            {
                return;
            }

            /*if (Time.time - _knockbackTimer < InvincibilityDuration)
             * {
             *  return;
             * }
             * else
             * {
             *  _knockbackTimer = Time.time;
             * }*/


            _lucyHealth = collider.gameObject.GetComponentNoAlloc <LucyHealth>();


            // if what we're colliding with is damageable
            if (_lucyHealth != null)
            {
                if (_lucyHealth._ultraSuitAcquired == false)
                {
                    if (_lucyHealth.CurrentHealth > 0)
                    {
                        OnCollideWithDamageable(_lucyHealth);
                    }
                }
            }

            // if what we're colliding with can't be damaged
            else
            {
                OnCollideWithNonDamageable();
            }

            //Make it so the flamethrower doesn't work in water
            _lucyFlamethrower = collider.gameObject.GetComponentNoAlloc <LucyFlamethrower>();

            if (_lucyFlamethrower != null)
            {
                _lucyFlamethrower.AbilityPermitted = false;
            }
        }
Ejemplo n.º 3
0
        /// <summary>
        /// When entering collision with something, we check if it's a player, and in that case we set our flag accordingly
        /// </summary>
        /// <param name="collider">Collider.</param>
        public virtual void OnTriggerEnter2D(Collider2D collider)
        {
            CorgiController controller = collider.GetComponent <CorgiController>();

            _lucyFlamethrower = collider.GetComponent <LucyFlamethrower>();

            if (controller == null)
            {
                return;
            }

            if (StayAnimated)
            {
                anim.SetBool("ElevatorMoving", true);
            }

            if (ScriptActivated)
            {
                PlayElevatorStuckSound();
                StartCoroutine(PlayStuckElevatorAnimation());

                _collidingWithPlayer = true;
                _collidingController = controller;

                if (_lucyFlamethrower.ShootingUp == true || _lucyFlamethrower.ShootingUpward == true)
                {
                    AuthorizeMovement();
                }
                else
                {
                    ForbidMovement();
                }

                if (_lucyFlamethrower.ShootingUp)
                {
                    MovementSpeed = 4f;
                }
                else
                {
                    MovementSpeed = _initialSpeed;
                }
            }
            else
            {
                if (StayAnimated)
                {
                    anim.SetBool("ElevatorMoving", true);
                }
            }
        }
Ejemplo n.º 4
0
        protected void OnTriggerExit2D(Collider2D collider)
        {
            //turn flamethrower back and set walk speed to normal on after leaving.
            _lucyFlamethrower = collider.gameObject.GetComponent <LucyFlamethrower>();

            if (_lucyFlamethrower != null)
            {
                _lucyFlamethrower.AbilityPermitted = true;
            }

            if (collider.gameObject.layer == 9)
            {
                //play splash effect
                if (EnterAcidSplashEffect != null)
                {
                    Instantiate(EnterAcidSplashEffect, collider.transform.position, collider.transform.rotation);
                }
                PlayEnterAcidSplashSfx();
            }
        }
        /// Override this to describe what happens when the object gets picked
        /// </summary>
        protected override void Pick()
        {
            base.Pick();
            _lucyFlamethrower = _collider.GetComponent <LucyFlamethrower>();
            _sprite           = gameObject.GetComponent <SpriteRenderer>();

            _lucyFlamethrower.FlameThrowerObtained = true;
            _sprite.enabled = false;

            //if we haven't already obtained it
            if (!GameManager.Instance.FlamethrowerObtained)
            {
                if (!GameManager.Instance.DebugMode)
                {
                    RunSplashScreen();
                }
                GameManager.Instance.FlamethrowerObtained = true;
                RetroAdventureProgressManager.Instance.SaveProgress();
            }
        }
Ejemplo n.º 6
0
        /// <summary>
        /// Grabs various components and inits stuff
        /// </summary>
        public virtual void Setup()
        {
            // filler if the WeaponAttachment has not been set
            if (WeaponAttachment == null)
            {
                WeaponAttachment = transform;
            }
            if (_animator != null)
            {
                _weaponIK = _animator.GetComponent <WeaponIK>();
            }
            // we set the initial weapon
            if (InitialWeapon != null)
            {
                ChangeWeapon(InitialWeapon, null);
            }
            _character = gameObject.GetComponentNoAlloc <Character>();

            _lucyFlamethrower = GetComponent <LucyFlamethrower>();
        }
Ejemplo n.º 7
0
        /// Override this to describe what happens when the object gets picked
        /// </summary>
        protected override void Pick()
        {
            base.Pick();
            _animator           = _collider.GetComponent <Animator>();
            _lucyFlamethrower   = _collider.GetComponent <LucyFlamethrower>();
            _sprite             = gameObject.GetComponent <SpriteRenderer>();
            _characterInventory = _collider.GetComponent <LucyInventory>();

            _lucyFlamethrower.SuperFlamethrowerObtained = true;
            _animator.runtimeAnimatorController         = Resources.Load("SFTAnimator") as RuntimeAnimatorController;
            _sprite.enabled = false;
            //if we haven't already obtained it
            if (!GameManager.Instance.SuperFlamethrowerObtained)
            {
                if (!GameManager.Instance.DebugMode)
                {
                    RunSplashScreen();
                }
                GameManager.Instance.SuperFlamethrowerObtained = true;
                RetroAdventureProgressManager.Instance.SaveProgress();
            }
        }
Ejemplo n.º 8
0
        protected override void Setup()
        {
            base.Setup();
            _animator      = GetComponent <Animator>(); 
 _characterHandleEMP = GetComponent <CharacterHandleEMP>(); 
 _lucyHealth = GetComponent <LucyHealth>(); 
 _magnetEffect = GetComponent <LucyMagnet>(); 
 _characterHandleMelee = GetComponent <CharacterHandleMelee>(); 
 _walljump = GetComponent <LucyWallJump>(); 
 _wallcling = GetComponent <LucyWallClinging>(); 
 _lucyFlamethrower = GetComponent <LucyFlamethrower>();
            _characterRun  = GetComponent <CharacterRun>();
            _plasmaRainbow = GetComponent <_2dxFX_PlasmaRainbow>();

            PowerNodesCollected = 0;

            StartCoroutine(AddItemsToInventory());

            StartCoroutine(GetTheRightSuitOn());
        }
Ejemplo n.º 9
0
 // Use this for initialization
 void Start()
 {
     _lucyFlamethrower = GetComponentInParent <LucyFlamethrower>();
 }