Exemplo n.º 1
0
 void Awake()
 {
     _detector    = transform.GetChild(0).GetComponent <PlayerDetection>();
     _postSearch  = GetComponentInChildren <FindPlayer>();
     _patrolBehav = GetComponent <Patrol>();
     _spriteHand  = GetComponent <Spritehandler>();
     _coneRender  = transform.GetChild(0).GetComponent <VisionConeRender>();
 }
    public void Start()
    {
        scoreScript      = GetComponent <GameSceneScript> ();
        findPlayerScript = GetComponent <FindPlayer>();
        startPositions   = new int[] { 0, 0 };
        chosenPositions  = new int[] { 0, 0 };

        //Find next player to pass ball to
        isCorrect = true;
        LoadNextQuestion();
    }
Exemplo n.º 3
0
 }                                                       // static singleton
 void Awake()
 {
     if (Instance == null)
     {
         Instance = this;
     }
     else
     {
         Destroy(gameObject);
     }
     // Cache references to all desired variables
     player = FindObjectOfType <CharacterController2D>();
 }
Exemplo n.º 4
0
    // Start is called before the first frame update
    void Start()
    {
        GameObject FindPlayerObject = GameObject.FindWithTag("FindPlayer");

        if (FindPlayerObject != null)
        {
            findPlayer = FindPlayerObject.GetComponent <FindPlayer> ();
        }
        else
        {
            Debug.Log("找不到tag为FindPlayer");
        }

        if (findPlayer == null)
        {
            Debug.Log("找不到 findPlayer 脚本");
        }
        switch (FindPlayer.index)
        {
        case 0: {
            Player = GameObject.Find("StarSparrow1 Variant 1");
            Player2.SetActive(false);
            Player3.SetActive(false);
            break;
        }

        case 1: {
            Player = GameObject.Find("StarSparrow3");
            Player1.SetActive(false);
            Player3.SetActive(false);
            break;
        }

        case 2: {
            Player = GameObject.Find("StarSparrow4");
            Player1.SetActive(false);
            Player2.SetActive(false);
            break;
        }

        default:
            break;
        }
        life           = 3;
        score          = 0;
        scoreText.text = "得分: " + score;
        HPText.text    = "\n\nHP: " + life;
        gameOver_Canves.SetActive(false);
        StartCoroutine(process());
    }
Exemplo n.º 5
0
    // Use this for initialization
    void Start()
    {
        Transform paret = transform.parent;

        if (paret == null)
        {
            return;
        }
        FindPlayer findPlayer = paret.GetComponent <FindPlayer>();

        if (findPlayer == null)
        {
            return;
        }
        VisionDistance = findPlayer.VisionDistance;
    }
Exemplo n.º 6
0
 public ai_1()
 {
     {
         SelectorLinear node1 = new SelectorLinear();
         this.AddChild(node1);
         {
             SequenceLinear node2 = new SequenceLinear();
             node1.AddChild(node2);
             {
                 IsPlayerInAttackRange node3 = new IsPlayerInAttackRange();
                 node2.AddChild(node3);
             }
             {
                 Attack node4 = new Attack();
                 node2.AddChild(node4);
             }
         }
         {
             SequenceLinear node5 = new SequenceLinear();
             node1.AddChild(node5);
             {
                 CanNotFindPlayer node6 = new CanNotFindPlayer();
                 node5.AddChild(node6);
             }
             {
                 Patrol node7 = new Patrol();
                 node7.PatrolRange = 5;
                 node5.AddChild(node7);
             }
         }
         {
             SequenceLinear node8 = new SequenceLinear();
             node1.AddChild(node8);
             {
                 FindPlayer node9 = new FindPlayer();
                 node8.AddChild(node9);
             }
             {
                 Chase node10 = new Chase();
                 node8.AddChild(node10);
             }
         }
     }
 }
Exemplo n.º 7
0
    // Start is called before the first frame update
    void Start()
    {
        GameObject FindPlayerObject = GameObject.FindWithTag("FindPlayer");

        if (FindPlayerObject != null)
        {
            findPlayer = FindPlayerObject.GetComponent <FindPlayer> ();
        }
        else
        {
            Debug.Log("找不到tag为FindPlayer");
        }

        if (findPlayer == null)
        {
            Debug.Log("找不到 findPlayer 脚本");
        }
        choose1.transform.GetComponent <Renderer>().enabled = true;
        choose2.transform.GetComponent <Renderer>().enabled = false;
        choose3.transform.GetComponent <Renderer>().enabled = false;
    }
Exemplo n.º 8
0
 public CheckPlayer(FindPlayer find, bool isNotUpdate = false)
 {
     m_Find        = find;
     m_isFind      = false;
     m_isNotUpdate = isNotUpdate;
 }
Exemplo n.º 9
0
 void OnEnable()
 {
     FindPlayer = (FindPlayer)target;
 }
Exemplo n.º 10
0
 void OnEnable()
 {
     FindPlayer = (FindPlayer)target;
 }
Exemplo n.º 11
0
 void Awake()
 {
     instance = this;
 }
Exemplo n.º 12
0
 void Awake()
 {
     Instance = this;
 }
Exemplo n.º 13
0
 void Awake()
 {
     Instance = this;
 }