コード例 #1
0
 public void Push(Vector3 Force, float weight, int damage)
 {
     if (inState == invState.isFalse)
     {
         Force *= weight;
         this.GetComponent <Rigidbody>().AddForce(Force);
         invcTimer = 0;
         inState   = invState.isTrue;
         health   -= damage;
     }
 }
コード例 #2
0
    void invincability()
    {
        if (inState == invState.isTrue)
        {
            invcTimer += 1 * Time.deltaTime;
            GetComponent <SpriteRenderer>().color = new Color(1f, 0.8f, 0.8f, 0.5f); // displaying invcibility
        }
        else
        {
            GetComponent <SpriteRenderer>().color = new Color(1f, 1f, 1f, 1f); // displaying invcibility
        }
        //might wanna add layers later to make it so ennemies go through player when invicble

        if (invcTimer > 100 * Time.deltaTime)
        {
            inState = invState.isFalse;
        }
    }