ObjectInteraction.GetHitFrameEnd C# (CSharp) Method

GetHitFrameEnd() public method

public GetHitFrameEnd ( ) : int
return int
    public int GetHitFrameEnd()
    {
        if (this.GetComponent<NPC>()==null)
            {
                    return 49;//End of explosion
            }
            else
            {
                switch (GameWorldController.instance.critter.Blood[item_id-64])
                {
                //Mask 0x0F is the splatter type, 0 for dust, 8 for red blood.
                case 0:
                        return 49;

                case 8://blood
                default:
                        return 5;
                }
            }
    }

Usage Example

Ejemplo n.º 1
0
    public string caster;     //who has cast the project. It will ignore them.

    void OnCollisionEnter(Collision collision)
    {
        if (collision.gameObject.name == caster)
        {
            return;
        }
        if (HasHit == true)
        {        //Only impact once.
            return;
        }
        else

        {
            HasHit = true;
            SpriteRenderer sprt = this.GetComponentInChildren <SpriteRenderer>();
            sprt.enabled = false;
            BoxCollider box = this.GetComponent <BoxCollider>();
            box.enabled = false;
            WindowDetect.FreezeMovement(this.gameObject);

            ObjectInteraction objInt = collision.gameObject.GetComponent <ObjectInteraction>();

            if (objInt != null)
            {
                objInt.Attack(damage);
                Impact imp = this.gameObject.AddComponent <Impact>();
                imp.FrameNo  = objInt.GetHitFrameStart();
                imp.EndFrame = objInt.GetHitFrameEnd();
                StartCoroutine(imp.Animate());
            }
            else
            {
                //test if this is a player.
                if (collision.gameObject.GetComponent <UWCharacter>() != null)
                {
                    collision.gameObject.GetComponent <UWCharacter>().ApplyDamage(damage);
                }
                else
                {
                    //do a miss impact
                    Impact imp = this.gameObject.AddComponent <Impact>();
                    imp.FrameNo  = 46;
                    imp.EndFrame = 50;
                    StartCoroutine(imp.Animate());
                }
            }

            DestroyObject(this.gameObject, 1);
        }
    }
All Usage Examples Of ObjectInteraction::GetHitFrameEnd