예제 #1
0
파일: Player.cs 프로젝트: Linkaan/LD40
 private void Explode()
 {
     Instantiate(explosionPrefab, this.transform.position, Quaternion.identity);
     arrowMgr.HideArrow();
     pathShower.hidePath();
     GameObject.Destroy(this.gameObject);
     sfxManager.Play(sfxManager.explode);
 }
예제 #2
0
    void FixedUpdate()
    {
        if (!hasInitiated)
        {
            hasInitiated  = true;
            agent.enabled = true;
            agent.SetDestination(currentDestination.goalPosition);
            onNewDestination();
        }
        if (agent.pathPending)
        {
            return;
        }
        if (hasInitiated)
        {
            if (agent.remainingDistance < agent.stoppingDistance)
            {
                Destination dest = destMgr.nextDestination();

                if (dest == null)
                {
                    Instantiate(explosionPrefab, this.transform.position, Quaternion.identity);
                    arrowMgr.HideArrow();
                    pathShower.hidePath();
                    GameObject.Destroy(this.gameObject);
                }
                else
                {
                    IconManager.SetIcon(startDestination.gameObject, IconManager.LabelIcon.Purple);
                    IconManager.SetIcon(currentDestination.gameObject, IconManager.LabelIcon.Purple);
                    SpawnGhost();
                    startDestination   = currentDestination;
                    currentDestination = dest;
                    agent.SetDestination(dest.goalPosition);

                    onNewDestination();
                }
            }

            if (Time.time - lastTime > 1.0f)
            {
                lastTime = Time.time;
                Waypoint point = new Waypoint();
                point.goalPosition = transform.position;
                waypoints.Add(point);
            }

            pathShower.displayPath(agent.path);
        }
    }