Beispiel #1
0
    void Awake()
    {
        id = s_Random.Next();

        m_Hp          = GetComponent <PropertyHP>();
        m_Hp.hp       = hpMax;
        m_Hp.postDead = Die;

        // life state
        {
            hitDisabled.postChanged += (_counter, _val) =>
            {
                if (_counter == 0)
                {
                    damageDetector.enabled = true;
                }
                else if (_counter.old == 0)
                {
                    damageDetector.enabled = false;
                }
            };
        }

        // components
        m_NetworkAnimator     = GetComponent <NetworkAnimator>();
        m_InterpolatePosition = gameObject.AddComponent <InterpolatePosition>();

        m_AnimationEventor.postThrowAway += ListenAnimationEventThrowAway;

        // detector
        crateDetector.doObtain  = Obtain;
        damageDetector.doDamage = Hit;

        terrainDetector.postDetect = (Collision) =>
        {
            floating = false;
            terrainDetector.gameObject.SetActive(false);
        };
    }
    void Awake()
    {
        m_Hp          = GetComponent <HasHP>();
        m_Hp.hp       = hpMax;
        m_Hp.postDead = Die;

        // components
        m_Renderers           = GetComponent <CharacterRenderer> ();
        m_Animator            = GetComponent <Animator>();
        m_NetworkAnimator     = GetComponent <NetworkAnimator>();
        m_InterpolatePosition = gameObject.AddComponent <InterpolatePosition>();

        // detector
        crateDetector.doObtain  = Obtain;
        damageDetector.doDamage = Hit;

        terrainDetector.postDetect = (Collision) =>
        {
            m_Floating = false;
            terrainDetector.gameObject.SetActive(false);
        };
    }
    void Awake()
    {
        id = s_Random.Next();

        m_Hp = GetComponent<PropertyHP>();
        m_Hp.hp = hpMax;
        m_Hp.postDead = Die;

        // life state
        {
            hitDisabled.postChanged += (_counter, _val) =>
            {
                if (_counter == 0)
                    damageDetector.enabled = true;
                else if (_counter.old == 0)
                    damageDetector.enabled = false;
            };
        }

        // components
        m_NetworkAnimator = GetComponent<NetworkAnimator>();
        m_InterpolatePosition = gameObject.AddComponent<InterpolatePosition>();

        m_AnimationEventor.postThrowAway += ListenAnimationEventThrowAway;

        // detector
        crateDetector.doObtain = Obtain;
        damageDetector.doDamage = Hit;

        terrainDetector.postDetect = (Collision) =>
        {
            floating = false;
            terrainDetector.gameObject.SetActive(false);
        };
    }
	void Awake () {
		m_Hp = GetComponent<HasHP>();
		m_Hp.hp = hpMax;
		m_Hp.postDead = Die;

		// components
		m_Renderers = GetComponent<CharacterRenderer> ();
		m_Animator = GetComponent<Animator>();
		m_NetworkAnimator = GetComponent<NetworkAnimator>();
		m_InterpolatePosition = gameObject.AddComponent<InterpolatePosition>();

		// detector
		crateDetector.doObtain = Obtain;
		damageDetector.doDamage = Hit;
		
		terrainDetector.postDetect = (Collision) =>
		{
			m_Floating = false;
			terrainDetector.gameObject.SetActive(false);
		};
	}