Пример #1
0
    public void startMe(int _pkmn, GameObject myself, Vector3 curs_pos, 
                GameObject player)
    {
        whichAction = "HALT_INIT";
        subactions = new Dictionary<string, float>();
        envir_info = new Dictionary<string, float>();
        envir_objects = new Dictionary<string, GameObject>();
        init_pos = player.transform.position;
        self_ref = myself;
        image_ref = transform.Find("Image").gameObject;
        player_ref = player;
        map_ref = GameObject.FindGameObjectsWithTag("World_Map")[0];
        maphandler_script = map_ref.GetComponent<MapHandler>();
        maphandle = maphandler_script.Map;
        player_action_script = player.GetComponent<ActionPlayer>();
        player_coll =  (CapsuleCollider)
                    player.GetComponentInChildren<CapsuleCollider>();
        coll = (CapsuleCollider) GetComponent<Collider>();
        pkmn = _pkmn;
        image_rnd = image_ref.GetComponent<Renderer>();
        default_image_scale = new Vector3(1.0f, 1.3f, 1.0f);

        image_rnd.enabled = false;

        if (magn(init_pos-curs_pos, false, 2) >
                        player_action_script.max_throw_dist) {
            Debug.Log(init_pos.ToString()+" -> "+curs_pos.ToString()+
                            ": Pokemon throwing distance too far.");
            whichAction = "KILL";
            return;
        }
        dirvecs.Add(new Vector3(0.0f,0.0f,maphandler_script.scale));
        dirvecs.Add(new Vector3(maphandler_script.scale,0.0f,0.0f));
        dirvecs.Add(new Vector3(0.0f,0.0f,-maphandler_script.scale));
        dirvecs.Add(new Vector3(-maphandler_script.scale,0.0f,0.0f));

        image_rnd.material.SetColor("_TintColor", Color.grey);
        if (maphandle.reserveTile(curs_pos, self_ref)) {
            initMe();
            throwMe(player, curs_pos);
        } else {
            whichAction = "KILL";
        }
    }