コード例 #1
0
    public void DetectHuman(GameObject human)
    {
        SurvivorBehaviour surv = human.GetComponent <SurvivorBehaviour>();

        if (surv != null)
        {
            human.GetComponent <SurvivorBehaviour>().ReceiveContact(this.gameObject);
        }
        if (goodness > 50)
        {
            if (human.GetComponent <Human>().isWounded())
            {
                //Comprobamos si el jugador tiene menos del 100% de vida
                setState(AIStates.Heal);
            }
            else
            {
                setState(AIStates.Give);
            }
        }
        else
        {
            if (goodness < 30)
            {
                setState(AIStates.Attack);
                print(name + " attacking " + actualTarget.name);
            }
            else
            {
                setState(AIStates.Steal);
            }
        }
    }
コード例 #2
0
 // Use this for initialization
 void Start()
 {
     survivor = GetComponentInParent <SurvivorBehaviour>();
 }