예제 #1
0
 // Start is called before the first frame update
 void Start()
 {
     Score      = FindObjectOfType <TextManager>();
     gameOver   = FindObjectOfType <GameOver>();
     isDead     = FindObjectOfType <MoveToPlayer>();
     anim       = GetComponent <Animator>();
     deathSound = GetComponent <AudioSource>();
     a          = FindObjectOfType <MoveToPlayer>();
 }
예제 #2
0
 // Use this for initialization
 void Start()
 {
     moveToPlayer = gameObject.GetComponent <MoveToPlayer>();
     anim         = gameObject.GetComponent <Animator>();
     IsShooten    = false;
     anim.SetBool("isDead", false);
     anim.SetBool("isWalk", true);
     audioSource    = gameObject.GetComponent <AudioSource>();
     player         = GameObject.FindGameObjectWithTag("Player");
     gameController = GameObject.FindGameObjectWithTag("GameController");
 }
예제 #3
0
 void Start()
 {
     if (move != null)
     {
         move = gameObject.GetComponent <MoveToPlayer>();
     }
     else if (randMove != null)
     {
         randMove = gameObject.GetComponent <RandomWalking>();
     }
 }
예제 #4
0
 void OnTriggerEnter(Collider other)
 {
     // Overlap was a pickup
     if (other.gameObject.CompareTag("Pickup"))
     {
         // Logic
         MoveToPlayer movementScript = other.gameObject.GetComponent <MoveToPlayer>();
         if (movementScript != null)
         {
             movementScript.BeginMovement();
         }
     }
 }
예제 #5
0
 void Start()
 {
     _audio     = gameObject.GetComponent <AudioSource> ();
     _enemyData = gameObject.GetComponent <EnemyData> ();
     if (gameObject.GetComponent <RandomWalking> () != null)
     {
         _enemyMovement = gameObject.GetComponent <RandomWalking> ();
     }
     else
     {
         _moveToPlayer = gameObject.GetComponent <MoveToPlayer>();
     }
 }
예제 #6
0
    // Use this for initialization
    void Start()
    {
        fishAgent = GetComponent <NavMeshAgent>();

        GameObject.FindGameObjectsWithTag("fish");

        fishAgent.updatePosition = true;
        fishAgent.updateRotation = true;

        wayPoints   = GameObject.FindGameObjectsWithTag("waypoint");
        wayPointInd = Random.Range(0, wayPoints.Length);

        AIState = KoiFishAI.fishState.MOVE;

        playerCapsule = GetComponent <MoveToPlayer>();

        RB = GetComponent <Rigidbody>();

        StartCoroutine("FSM");

        moveSpeed = Random.Range(0.8f, 1.2f);
    }
예제 #7
0
    public void Destroy()
    {
        if (player)
        {
            StartCoroutine("restartGame");
        }
        else
        {
            //TODO: this should all really be in its own subclass of destroyable for enemies
            MoveToPlayer mtp = GetComponent <MoveToPlayer>();
            if (mtp)
            {
                DestroyObject(mtp.agent.gameObject);

                if (remains)
                {
                    Instantiate(remains, this.transform.position, this.transform.rotation);
                }
            }
            DestroyObject(this.gameObject);
        }
    }
예제 #8
0
 // Update is called once per frame
 void Update()
 {
     isDead = this.gameObject.GetComponent <MoveToPlayer>();
 }
예제 #9
0
    void Start()
    {
        move = gameObject.GetComponent <MoveToPlayer> ();

        PosMalinche(QuestData.levelSpot);
    }