Beispiel #1
0
        public IEnumerator newObstacle()
        {
            GameObject  obstacle = Instantiate(Resources.Load("Prefabs/Obstacle"), new Vector3(Random.Range(-screen.x, screen.x), screen.y, 0), Quaternion.identity) as GameObject;
            ActiveStats attr     = obstacle.GetComponent <ActiveStats>();

            attr.Life(root);
            attr.movement.speed = Random.Range(4, 12);
            attr.owner          = StatsOwnerType.OBSTACLE;

            AImove aiMove = obstacle.GetComponent <AImove>();

            aiMove.setBounds(screen.x, -screen.x, screen.y, 0);
            Transform obstacleScale = obstacle.transform;

            obstacleScale.localScale          =
                obstacle.transform.localScale = new Vector3(Random.value + 0.3f, 1, 1);
            obstacle.transform.SetParent(transform);
            obstacles.Add(obstacle);

            yield return(new WaitForSeconds(1));

            ai.Add(aiMove);

            obstacle.SetActive(true);
        }
Beispiel #2
0
    void Start()
    {
        if (gameObject.GetComponent <ActiveStats>() != null)
        {
            activeStats = gameObject.GetComponent <ActiveStats>();
        }
        Vector3 screen = Camera.main.ScreenToWorldPoint(new Vector3(Screen.width, Screen.height, 0));

        xMin = (-screen.x) - (transform.localScale.x / 2.5f);
        xMax = screen.x + (transform.localScale.x / 2.5f);
    }
Beispiel #3
0
        private void playerBuild(int healthPoints)
        {
            player      = Instantiate(Resources.Load("Prefabs/Player"), Vector3.zero, Quaternion.identity) as GameObject;
            activeStats = player.GetComponent <ActiveStats>();
            activeStats.Life(root);
            activeStats.health.maxHealth     = healthPoints;
            activeStats.health.currentHealth = healthPoints;
            activeStats.movement.speed       = 5f;
            activeStats.owner = StatsOwnerType.PLAYER;
            DebugUtil.verifyNotNull(root, "root in playerBuild()");

            player.transform.SetParent(this.transform);
        }
Beispiel #4
0
 void redrawObstacles()
 {
     foreach (GameObject obst in obstacles)
     {
         Destroy(obst);
     }
     for (int i = 0; i < obstacleAmount; i++)
     {
         obstacles[i] = Instantiate(Resources.Load("Prefabs/Obstacle"), new Vector3(Random.Range(-2.5f, 2.5f), ceiling, 0), Quaternion.identity) as GameObject;
         ActiveStats attr = obstacles[i].GetComponent <ActiveStats>();
         attr.movement.speed = Random.Range(3, 10);
     }
     shouldRecount = false;
 }
Beispiel #5
0
    void OnTriggerEnter(Collider other)
    {
        Debug.Log("DAMAGE!");

        ActiveStats attr = other.gameObject.GetComponent <ActiveStats>();

        Debug.Log(string.Format("attribute {0}", other.gameObject.name));
        if (attr != null)
        {
            if (!attr.abilities.getShieldActive())
            {
                attr.health.inflictDamage(damage);
            }
        }
    }
Beispiel #6
0
 public Abilities(ActiveStats owner)
 {
     ownerStats = owner;
 }
Beispiel #7
0
 public Movement(ActiveStats ownerStats)
 {
     this.ownerStats = ownerStats;
 }
Beispiel #8
0
 public Health(ActiveStats ownerStats)
 {
     this.ownerStats = ownerStats;
 }