示例#1
0
    void Start()
    {
        center   = GameObject.Find("Center");
        canShoot = true;
        canEnd   = true;

        rotationSpeed = 1.5f;

        inputManager         = GameObject.FindObjectOfType <InputManager>();
        starSpawnerScript    = GameObject.FindObjectOfType <StarSpawner>();
        circleScoreTransform = GetComponentsInChildren <Transform>()[2];

        Vector3 difference = center.transform.position - transform.position;
        float   rotZ       = Mathf.Atan2(difference.y, difference.x) * Mathf.Rad2Deg;

        transform.rotation           = Quaternion.Euler(0.0f, 0.0f, rotZ);
        transform.rotation          *= Quaternion.Euler(0, 0, -180);
        startRotation                = transform.rotation;
        timeBetweenRotation          = 2f;
        timerRotation                = timeBetweenRotation * 0.33f;
        constellatedStarsNeededToWin = 25.00f;
        constellatedStars            = 0.00f;

        circleScoreTranformSize = 0.00f;
    }
示例#2
0
 private void Awake()
 {
     if (instance == null)
     {
         instance = this;
     }
 }
    void Awake()
    {
        //make static or destroy
        if (starSpawner == null)
        {
            DontDestroyOnLoad(gameObject);
            starSpawner = this;
        }
        else
        {
            Destroy(gameObject);
        }

        //set rating method
        starSpawning = new GameObject[rate.size];

        for (int i = 0; i < starSpawning.Length; i++)
        {
            if (i <= rate.yellowRate) //load up rate of yellow
            {
                starSpawning[i] = Resources.Load <GameObject>("Prefab/TruePrefab/Star/StarYellow_Prefab");
            }
            else if (i <= rate.yellowRate + rate.blueRate) //load up rate of blue
            {
                starSpawning[i] = Resources.Load <GameObject>("Prefab/TruePrefab/Star/StarBlue_Prefab");
            }
            else if (i > rate.yellowRate + rate.blueRate) //load up rate of purple
            {
                starSpawning[i] = Resources.Load <GameObject>("Prefab/TruePrefab/Star/StarPurple_Prefab");
            }
        }
    }
示例#4
0
 // Use this for initialization
 void Start()
 {
     valueHolder = GameObject.FindWithTag("ValueHolder").GetComponent <ValueHolder> ();
     endPoint    = GameObject.FindGameObjectWithTag("EndPoint");
     spawner     = GameObject.FindWithTag("StarSpawner").GetComponent <StarSpawner> ();
     spawner.starList.Add(this.gameObject);
     target = endPoint.transform.position;
 }
示例#5
0
 void Start()
 {
     scaleRand            = Random.Range(0.08f, 0.20f);
     alphaRand            = Random.Range(0.5f, 1f);
     angleRand            = Random.Range(0.007f, 0.025f);
     transform.localScale = new Vector2(scaleRand, scaleRand);
     GetComponent <SpriteRenderer>().color = new Color(1, 1, 1, alphaRand);
     center            = GameObject.Find("Center");
     starSpawnerScript = GameObject.FindObjectOfType <StarSpawner>();
 }
示例#6
0
    void Start()
    {
        camRB       = GetComponent <Rigidbody> ();
        starSpawner = GameObject.Find("StarSpawner").GetComponent <StarSpawner> ();

        if (StaticVars.currentDifficulty == StaticVars.Difficulty.Easy)
        {
            cameraSpeed -= 0.05f;
            starSpawner.spawnSeconds -= .5f;
        }
        else if (StaticVars.currentDifficulty == StaticVars.Difficulty.Unfair)
        {
            cameraSpeed += 0.1f;
            starSpawner.spawnSeconds += .5f;
        }
    }
示例#7
0
 void Awake()
 {
     starSpawner    = GameObject.Find("StarSpawnerObj").GetComponent <StarSpawner>() as StarSpawner;
     terrainSpawner = GameObject.Find("TerrainSpawnerObj").GetComponent <TerrainSpawner>() as TerrainSpawner;
 }
示例#8
0
    void HandleInteraction(Tuple <Movement, Spell> ms)
    {
        Entity actor = _world.GetActorEntity();
        int    dx = 0, dy = 0;

        switch (ms.Item1.type)
        {
        case Movement.L:
            dx = -1;
            break;

        case Movement.R:
            dx = 1;
            break;

        case Movement.B:
            dy = -1;
            break;

        case Movement.F:
            dy = 1;
            break;

        default:
            break;
        }

        switch (ms.Item2.type)
        {
        case Spell.I:
        {
            Entity e = _world.FindEntity(actor.x + dx, actor.y + dy);
            if (e != null)
            {
                switch (e.type)
                {
                case Entity.SPIKE:
                    dead      = true;
                    deadAfter = 0.75f;
                    break;

                case Entity.BARRIER:
                    dead      = true;
                    deadAfter = 0.4f;
                    break;

                case Entity.TREASURE:
                    won      = true;
                    wonAfter = 0.55f;
                    StarSpawner spawner = e.obj.GetComponent <StarSpawner>();
                    spawner.shouldSpawn = true;
                    break;
                }
            }

            actor.x += dx;
            actor.y += dy;
            break;
        }

        case Spell.SLASH:
        {
            Entity e = _world.FindEntity(actor.x + dx, actor.y + dy);
            if (e != null)
            {
                switch (e.type)
                {
                case Entity.BARRIER:
                    e.obj.AddComponent <ScaleDestroyer>();
                    _world.RemoveEntity(e);
                    break;
                }
            }
            break;
        }

        case Spell.JUMP:
        {
            for (int i = 1; i <= jumpStride; i++)
            {
                Entity e = _world.FindEntity(actor.x + dx * i, actor.y + dy * i);
                if (e != null)
                {
                    switch (e.type)
                    {
                    case Entity.BARRIER:
                        dead      = true;
                        deadAfter = i - 1 + 0.4f;
                        goto Done;
                        break;

                    case Entity.SPIKE:
                        if (i == jumpStride)
                        {
                            dead      = true;
                            deadAfter = i;
                            goto Done;
                        }
                        break;
                    }
                }
            }

Done:
            actor.x += jumpStride * dx;
            actor.y += jumpStride * dy;
            break;
        }
        }
    }