Exemplo n.º 1
0
    void Shoot()
    {
        GameObject      attackGO = (GameObject)Instantiate(pulsePrefab, firePoint.position, firePoint.rotation);
        PulseController pulse    = attackGO.GetComponent <PulseController>();

        if (pulse != null)
        {
            pulse.spellSpeed = spellSpeed;
        }
    }
Exemplo n.º 2
0
 void PlayerDamage(PulseController missile)
 {
     if (missile)
     {
         health -= missile.GetDamage();
         missile.Hit();
         if (health <= 0)
         {
             Destroy(gameObject);
             levelManager.LoadLevel("Win Screen");
         }
     }
 }
Exemplo n.º 3
0
    //Called when object is enabled
    private void OnEnable()
    {
        pControllers = GetComponentsInChildren <PulseController>();

        store = GameObject.Find("Controller").GetComponent <ObjectStore>();

        comingFrom = store.lastControlledTree;

        if (store.treePattern.IsMatch(comingFrom.name))
        {
            GameObject temp = GameObject.Find(store.treePattern.Match(comingFrom.name).Value + "_");
            priorController = temp.GetComponent <PulseController>();
        }
    }
Exemplo n.º 4
0
    public void UpdatePulseControllers(GameObject obj)
    {
        //If the object does not match the correct parrent then we need to ignore it
        if (!treePattern.IsMatch(obj.name))
        {
            Debug.LogWarning(obj.name + ": Name does not match the format for a tree.");
            return;
        }

        Debug.Log("Adding " + obj.name + " to " + treePattern.Match(obj.name).Value + "_");
        //Get the PulseController from the origin tree
        PulseController pC = GameObject.Find(treePattern.Match(obj.name).Value + "_").GetComponent <PulseController>();

        pC.Add(obj);
    }
Exemplo n.º 5
0
 void EnemyDamage(PulseController missile)
 {
     print(enemyValue);
     if (missile)
     {
         health -= missile.GetDamage();
         missile.Hit();
         if (health <= 0)
         {
             Destroy(gameObject);
             enemySounds.PlayEnemyDying();
             scoreKeeper.HitScore(enemyValue);
         }
     }
 }
Exemplo n.º 6
0
    // Use this for initialization
    void Start()
    {
        bigPicture = GameObject.Find("BigPicture");
        helpText = GameObject.Find("HelpText");
        driverState = GameDriverState.Start;
        pc = GameObject.Find("PulseController").GetComponent<PulseController>();
        tm = GameObject.Find("TypeMaster").GetComponent<TypeMaster>();
        gameState = GameObject.Find("GameState").GetComponent<GameState>();

        if (gameState.gameConfig != null)
        {
            bigPicture.GetComponent<Renderer>().material.SetTexture("_MainTex", gameState.gameConfig.bigTexture);
            GameObject heart = bigPicture.transform.Find("Heart").gameObject;
            heart.transform.localPosition = gameState.gameConfig.heartOffset;
            float n = gameState.gameConfig.heartScale;
            heart.transform.localScale = new Vector3(n, n, n);
        }
    }
Exemplo n.º 7
0
    void HandleTreePossession(GameObject tree)
    {
        string rootTree = null;

        if (!store.treePattern.IsMatch(tree.name))
        {
            return;
        }

        rootTree = store.treePattern.Match(tree.name) + "_";

        PulseController pC = GameObject.Find(rootTree).GetComponent <PulseController>();

        if (pC.GetLastInLine().name.Equals(tree.name))
        {
            placement.UpdateObjectToPlace(store.GetTreeName(tree.name), "tree", store.GetTree(), mouseHit.point);
            placement.placing = true;
        }
    }
    // Use this for initialization
    void Start()
    {
        camJuice = Camera.main.GetComponent<CameraJuice>();

        TextMesh textMesh = GetComponent<TextMesh>();
        pulse = transform.parent.GetComponent<PulseController>();
        Color feedbackColor;
        float distance = pulse.GetBeatDistance(beatPos);
        if (distance < pulse.distanceGood)
        {
            textMesh.text = "Good";
            feedbackColor = Color.green;
            camJuice.BeatGood();
        }
        else if (distance < pulse.distanceFair)
        {
            textMesh.text = "Fair";
            feedbackColor = Color.yellow;
            camJuice.BeatFair();
        }
        else
        {
            textMesh.text = "Bad";
            feedbackColor = Color.red;
            camJuice.BeatBad();
        }

        LineRenderer line = GetComponent<LineRenderer>();
        line.SetPosition(0, new Vector3(beatPos-20, 2, 0));

        lineMaterial = line.material;
        lineMaterial.color = feedbackColor;
        startTime = Time.time;
        startPos = transform.position;
        endPos = startPos;
        endPos.y -= moveAmount;
    }
Exemplo n.º 9
0
 void Start()
 {
     pc = GameObject.Find("PulseController").GetComponent<PulseController>();
     targetOffset = targetTemplate.GetComponent<TextMesh>().fontSize / 10;
     targets = new List<TypeTarget>();
     for(int i=0;i<startList.Length;i++)
         targets.Add(CreateTarget(i, startList[i]));
 }
Exemplo n.º 10
0
    void OnTriggerEnter2D(Collider2D col)
    {
        PulseController missile = col.gameObject.GetComponent <PulseController>();

        EnemyDamage(missile);
    }