Exemple #1
0
    void Init()
    {
        m_RotationSpeed = m_OrdinaryRotationSpeed;
        m_State         = FOState.InConveyor;
        SetSpeed(m_FallingSpeed);

        GUIText guiText = GetComponentInChildren(typeof(GUIText)) as GUIText;

        guiText.anchor   = TextAnchor.MiddleCenter;
        guiText.fontSize = 30;
        SetText(((int)rigidbody2D.mass).ToString());
    }
 public void SetState(FOState newState)
 {
     if (_isinit)
     {
         _states[_currentState].enabled = false;
         _states[_currentState].EndState();
     }
     _currentState = newState;
     _states[_currentState].BeginState();
     _states[_currentState].enabled = true;
     //   _anim.SetInteger("CurrentState", (int)_currentState);
 }
Exemple #3
0
    public void ImpactByBombBlowingUp(Vector3 bomb_p)
    {
        m_State = FOState.FallingDown;
        rigidbody2D.isKinematic = false;

        Vector3     force_dir     = transform.position - bomb_p;
        const float blow_up_power = 30.0f;

        force_dir.Normalize();
        force_dir               *= blow_up_power;
        rigidbody2D.velocity     = force_dir;
        rigidbody2D.gravityScale = 4.0f;
    }
Exemple #4
0
 public bool TryToChew(GameObject chew_by)
 {
     if (m_State != FOState.InConveyor)
     {
         return(false);
     }
     m_ChewingHead           = chew_by;
     m_State                 = FOState.Chewing;
     rigidbody2D.isKinematic = true;         // If isKinematic is enabled, Forces, collisions or joints will not affect the rigidbody anymore
     m_RotationSpeed         = 0.0f;
     m_ChewingStartRot       = transform.rotation;
     SetText("");
     return(true);
 }
Exemple #5
0
 public void Fall()
 {
     m_State = FOState.FallingDown;
     rigidbody2D.isKinematic = false;
     SetSpeed(m_FallingSpeed);
 }
Exemple #6
0
 void SelfDestroy()
 {
     m_State = FOState.Destroyed;
     Destroy(this.gameObject);
     Destroy(this);
 }