Example #1
0
    public void ShootPeople()
    {
        var publicServants = CorrupterManager.GetCorrupterByID((int)CorrupterType.PublicServant);

        if (publicServants.Count > 0)
        {
            PublicServant[] closestPublicServantArray = new PublicServant[1];
            float           closestDistance           = Screen.width;
            float           distance;
            foreach (var publicServant in publicServants)
            {
                distance = Vector3.Distance(this.transform.position, publicServant.transform.position);
                if (closestDistance > distance)
                {
                    closestDistance = distance;
                    closestPublicServantArray[0] = publicServant as PublicServant;
                }
            }
            SoundManager.inst.PlaySFXOneShot(6);
            if (closestPublicServantArray[0] != null)
            {
                closestPublicServantArray[0].Die();
            }
        }
    }
    public void Die()
    {
        isHappy = true;
        anim.Play("Action");
        CorrupterManager.Despawn(this);

        SoundManager.inst.PlaySFXOneShot(12);
        this.GetComponent <Collider>().enabled = false;
        //this.gameObject.SetActive(false);
    }