Esempio n. 1
0
    // Start is called before the first frame update
    private void Start()
    {
        //
        // Ensure rigidbody is present
        m_rigidbody = GetComponent <Rigidbody>();
        Assert.IsNotNull(m_rigidbody);

        //
        // Ensure WeaponHolder is present
        m_weaponHolder = GetComponent <WeaponHolder>();
        Assert.IsNotNull(m_weaponHolder);

        //
        // Ensure BonusHolder is present
        m_bonusHolder = GetComponent <BonusHolder>();
        Assert.IsNotNull(m_bonusHolder);

        //
        // Initialize / Reset
        ResetWallJump();

        //
        //
        m_audioSource = GetComponent <AudioSource>();
        Assert.IsNotNull(m_audioSource);

        //
        m_fWaftTimer = m_fWaftCooldown;
    }
Esempio n. 2
0
    void Start()
    {
        Material material = null;

        if (playerEnum.Equals(EPlayerEnum.p1) && PlayerStaticData.P1Material != null)
        {
            material = PlayerStaticData.P1Material;
        }
        else if (PlayerStaticData.P2Material != null)
        {
            material = PlayerStaticData.P2Material;
        }

        if (material != null)
        {
            SkinnedMeshRenderer[] meshes = gameObject.GetComponentsInChildren <SkinnedMeshRenderer>();
            for (int iMeshIndex = 0; iMeshIndex < meshes.Length; ++iMeshIndex)
            {
                meshes[iMeshIndex].material = material;
            }
        }

        rigidBody   = gameObject.GetComponent <Rigidbody>();
        bonusHolder = gameObject.GetComponent <BonusHolder>();
        percentage  = 0.0f;

        m_audioSource = GetComponent <AudioSource>();
    }
Esempio n. 3
0
    private void OnTriggerEnter(Collider other)
    {
        BonusHolder bonusHolder = other.gameObject.GetComponent <BonusHolder>();

        if (null != bonusHolder)
        {
            //
            // Notify BonusHolder
            bonusHolder.OnBonusPickedUp(this);

            //
            // Destroy Bonus and notify spawner
            Destroy(this.gameObject);
            m_spawner.OnBonusDisappeared();
        }
    }