Exemplo n.º 1
0
    public void SetCatcher(Transform c)
    {
        catcher = c;

        button     = catcher.Find("CatchButton");
        stick      = catcher.Find("MoveStick");
        controller = catcher.Find("Claw Controller");
        clawCatch  = controller.GetComponent <ClawCatch>();
        id         = dispatcher.playerID;
    }
Exemplo n.º 2
0
    void Start()
    {
        mainCamera = GameObject.Find("Main Camera").transform;
        dispatcher = GameObject.Find("Dispatcher").GetComponent <Dispatcher>();

        button     = catcher.Find("CatchButton");
        stick      = catcher.Find("MoveStick");
        controller = catcher.Find("Claw Controller");
        clawCatch  = controller.GetComponent <ClawCatch>();
        id         = dispatcher.playerID;
    }
Exemplo n.º 3
0
    public void CatchStrategy()
    {
        if (!isAI)
        {
            return;
        }
        if (player.GetCoin() < dispatcher.GetOpponentCost(id))
        {
            return;
        }
        // only catch once
        GameObject[]      dolls = GameObject.FindGameObjectsWithTag("Doll");
        List <GameObject> gList = new List <GameObject>();

        for (int i = 0; i < dolls.Length; i++)
        {
            if (Vector3.Distance(dolls[i].transform.position, catcher.position) <= 7)
            {
                gList.Add(dolls[i]);
            }
        }
        int n = gList.ToArray().Length;

        if (n == 0)
        {
            return;
        }
        n           = Random.Range(0, n);
        catchTarget = gList.ToArray()[n].transform;
        controller  = catcher.Find("Claw Controller");
        claw        = controller.Find("Claw");
        button      = catcher.Find("CatchButton");
        stick       = catcher.Find("MoveStick");
        clawCatch   = controller.GetComponent <ClawCatch>();

        prepareFlag = true;
        prepare     = 2;
    }