Esempio n. 1
0
    // Update is called once per frame
    void Update()
    {
        if (Vector3.Distance(waypoints[currentWaypoint], transform.position) < 1.0f)
        {
            currentWaypoint = (currentWaypoint + 1) % waypoints.Count;
        }
        Vector3 desired = waypoints[currentWaypoint] - transform.position;

        desired.Normalize();
        desired *= maxSpeed;
        Vector3 force = desired - velocity;

        Vector3 acceleration = force / mass;

        velocity += acceleration * Time.deltaTime;
        transform.Translate(velocity * (Time.deltaTime * 4), Space.World);
        transform.forward = velocity;
        checkDeath();
        if (gameObject.transform.position.z < -20)
        {
            CoreBehaviour.takeHealth(damage);
            Debug.Log("Death by position");
            Destroy(this.gameObject);
            done = true;
        }
    }
Esempio n. 2
0
    }//end start

    void Update()
    {
        spawnCDremaining -= Time.deltaTime;
        if (spawnCDremaining < 0)
        {
            bool didSpawn = false;
            spawnCDremaining = spawnCD;
            //go through waves
            foreach (WaveComponent wc in waveComps)
            {
                if (wc.spawned < wc.num)
                {
                    wc.spawned++;

                    Instantiate(wc.enemyPrefab, this.transform.position, this.transform.rotation);
                    didSpawn = true;

                    if (wc.enemyPrefab.tag == "Enemy")
                    {
                        waveCheckEnemy = true;
                    }//end if

                    if (wc.enemyPrefab.tag == "WavePause" && waveCheckEnemy)
                    {
                        CoreBehaviour.waveIncrement();
                        waveCheckEnemy = false;
                    }//end if

                    break;
                }
            } //end for each
        }
    }         //end update
Esempio n. 3
0
        /**************/

        /// <summary>
        /// Sets the default values of DataVO
        /// </summary>
        private void SetDefaultValues()
        {
            dataVO.version            = "1.0.0";
            dataVO.currentEnvironment = "";
            dataVO.defaultEnvironment = "Environment";

            // Search for a GameObject with CoreBehaviour componenent attached
            CoreBehaviour coreBehaviour = GameObject.FindObjectOfType <CoreBehaviour>();

            if (coreBehaviour != null)
            {
                dataVO.version            = Application.version;
                dataVO.defaultEnvironment = coreBehaviour.DefaultEnvironmentScene;
                dataVO.isDebug            = coreBehaviour.debug;
            }
        }
Esempio n. 4
0
 void Update()
 {
     moneyText.text  = "Gold: " + money.ToString();
     healthText.text = "Health: " + CoreBehaviour.getHealth();
 }
Esempio n. 5
0
    private void Awake()
    {
        Instance = this;

        currentRotation = new Vector3(transform.rotation.eulerAngles.x, 0, 0);
    }
Esempio n. 6
0
        /************************/

        /// <summary>
        /// Initializes a new instance of the <see cref="T:UnityPureMVC.Core.View.Mediators.CoreMediator"/> class.
        /// </summary>
        internal CoreMediator(CoreBehaviour coreBehaviour) : base(NAME)
        {
            m_viewComponent = coreBehaviour;
        }