Esempio n. 1
0
    void Update()
    {
        if (currentBehaviour == null)
        {
            return;
        }

        if (stunTimer > 0)
        {
            if (myHalo == null)
            {
                myHalo = (GameObject)Instantiate(CommonObjectsStore.me.stunHalo, ac.getHead().transform);
                myHalo.transform.localPosition = Vector3.zero;
            }
            stunTimer -= Time.deltaTime;
            return;
        }

        if (knockedDown == false)
        {
            if (myHalo != null)
            {
                Destroy(myHalo);
            }
        }


        if (knockedDown == false && npcB.myType != AIType.hostage)
        {
            skipAiCheckOnFrame = false;
            if (currentBehaviour == null)
            {
            }
            else
            {
                currentBehaviour.OnUpdate();
            }
        }
        else if (knockedDown == true)
        {
            knockedOut();
        }
    }
Esempio n. 2
0
    public void knockOutNPC()
    {
        if (npcB.myType == AIType.hostage)
        {
            return;
        }
        ArtemAnimationController ac = this.gameObject.GetComponentInChildren <ArtemAnimationController> ();

        ac.setFallen();
        PersonAnimationController pac = this.GetComponent <PersonAnimationController> ();

        //pac.forceFinishCurrentAnim ();
        pac.animationsToPlay.Clear();
        pac.playing = null;
        pac.counter = 0;
        pac.playAnimation("Knock", true);
        knockedDown = true;
        this.gameObject.GetComponent <SpriteRenderer> ().sortingOrder = 1;
        this.gameObject.tag = "Dead/Knocked";
        //ac.disableBodyParts ();
        //legs = this.GetComponentInChildren<Legs> ().gameObject;
        //legs.SetActive (false);
        head = ac.getHead();         //this.GetComponentInChildren<HeadController> ().gameObject;
        //this.GetComponent<SpriteRenderer> ().sprite = ac.myAesthetic.knocked;
        this.GetComponent <Rigidbody2D> ().isKinematic     = true;
        this.GetComponent <Rigidbody2D> ().angularVelocity = 0.0f;
        this.GetComponent <Rigidbody2D> ().velocity        = new Vector2(0, 0);
        //head.SetActive (false);
        pmc.enabled = false;
        pwc.enabled = false;
        //this.GetComponent<Collider2D> ().isTrigger = true;
        myCol.setTrigger();
        this.gameObject.GetComponentInChildren <CircleCollider2D> ().enabled = false;

        detect.fov.enabled = false;
        detect.fov.viewMeshFilter.gameObject.SetActive(false);
        //this.gameObject.AddComponent<PlayerAction_TieUpHostage> ();
        if (this.GetComponent <PlayerAction_HumanShield> () == true)
        {
            this.GetComponent <PlayerAction_HumanShield> ().enabled = false;
        }
        SpriteRenderer[] srs = this.gameObject.GetComponentsInChildren <SpriteRenderer> ();

        foreach (SpriteRenderer sr in srs)
        {
            sr.sortingOrder = sr.sortingOrder - 10;
        }

        Container c = this.gameObject.AddComponent <Container> ();

        c.containerName    = "Unconscious Person";
        c.itemsInContainer = new List <Item> ();
        Inventory i = this.gameObject.GetComponent <Inventory> ();

        foreach (Item it in i.inventoryItems)
        {
            c.addItemToContainer(it);
        }
        i.inventoryItems.Clear();
        this.gameObject.AddComponent <PlayerAction_DragCorpse> ();
    }