示例#1
0
 void Start()
 {
     penguindata = GetComponent <PenguinData>();
     eventLog    = GetComponent <PlayerLog>();
     EarthquakePickup.GetComponent <Earthquake>().enabled = false;
     LeafRaftPickup.GetComponent <LeafRaft>().enabled     = false;
 }
示例#2
0
 // Use this for initialization
 void Start()
 {
     penguinData = gameObject.GetComponent <PenguinData> ();
     SelectProjectileType(0);
     fireTimerLimit = normalFireTimer;
     Flame.gameObject.SetActive(false);
 }
示例#3
0
 // Use this for initialization
 void Awake()
 {
     pointsTextMesh       = awardTextOBJ.GetComponent <TextMesh> ();
     penguin              = GameObject.Find("Penguin");
     penguinData          = penguin.GetComponent <PenguinData> ();
     pickupSpawnTransform = gameObject.transform;
     source = GetComponent <AudioSource>();
 }
示例#4
0
    public static void Parse(ref Data data, World world, InputsManager input, Settings settings)
    {
        // moved to calculatereticle.cs

        PenguinData charData = new PenguinData {
            wandAngle = data.angleToMouse
        };

        world.penguinObj.GameUpdate(charData, input, ref data, settings, world);
    }
示例#5
0
    // Use this for initialization
    void Start()
    {
        spawntimeE  = 5 + Random.Range(0, 10);
        spawntimeM  = 3 + Random.Range(0, 5);
        spawntimeH  = 2 + Random.Range(0, 3);
        Penguin     = GameObject.Find("Penguin");
        penguinData = Penguin.GetComponent <PenguinData>();
        Directory   = Penguin.GetComponent <PenguinDirectory>();

        timer = 0;
    }
示例#6
0
 // Use this for initialization
 void Start()
 {
     eventLog          = GetComponent <PlayerLog>();
     Time.timeScale    = 1;
     penguinMovement   = GameObject.Find("PenguinMovement");
     shootScript       = gameObject.GetComponent <ShootScript> ();
     PenguinInfoHolder = GetComponent <PenguinData>();
     penguinData       = GameObject.Find("Penguin").GetComponent <PenguinData>();
     SpawnTimeMin      = 20 - (penguinData.difficultyIndex * 0.36f);
     SpawnTimeMax      = 20;
 }
    // Use this for initialization
    void Start()
    {
//		spawntimeE = 5 + Random.Range(0, 10);
//		spawntimeM = 3 + Random.Range(0, 5);
//		spawntimeH = 2 + Random.Range(0, 3);
        Penguin     = GameObject.Find("Penguin");
        penguinData = Penguin.GetComponent <PenguinData>();
        Directory   = Penguin.GetComponent <PenguinDirectory>();
        penguinMovementController = GameObject.Find("PenguinMovement").GetComponent <PenguinMovementController> ();
        spawnTimeMin = Directory.SpawnTimeMin;
        timer        = Random.Range(10, spawnTimeMin);
        spawnTimeMax = Directory.SpawnTimeMax;
    }
 // Use this for initialization
 void Start()
 {
     Time.timeScale = 1;
     penguinData    = (gameObject.GetComponent <PenguinData> ());
 }
 // Use this for initialization
 void Awake()
 {
     obstacleHealth    = 1;
     penguin           = GameObject.Find("Penguin");
     penguinInfoHolder = penguin.GetComponent <PenguinData>();
 }
    void doMovement()
    {
        //Movement keys
        //Debug.Log(gameObject.transform.eulerAngles.z);



        if (Input.GetKey(KeyCode.A) || Input.GetKey(KeyCode.LeftArrow) || Input.GetKey(KeyCode.D) || Input.GetKey(KeyCode.RightArrow) || Input.GetAxis("AxisX") >= .1f || Input.GetAxis("AxisX") <= -.1f)//a catch that isnt filled down below. WHile a key is pressed it increments movementheldtimer
        {
            movementHeldTimer       += Time.deltaTime;
            constantTransitionTimer += Time.deltaTime;
        }

        #region SnapMovement
        if (isSnapMovement)
        {
            if (movementHeldTimer >= 0 && movementHeldTimer < movementHeldTimerValue)
            {
                if (Input.GetKeyDown(KeyCode.A) || Input.GetKeyDown(KeyCode.LeftArrow) || Input.GetAxis("AxisX") >= .1f)
                {
                    if (!is360 && (gameObject.transform.eulerAngles.z > 334 || gameObject.transform.eulerAngles.z < 26))
                    {
                        curRotation -= (Time.deltaTime * dodgeSpeed);
                        if (curRotation < -26 || curRotation > 26)
                        {
                            curRotation = -24.9f;
                        }
                        //Debug.Log("curRotation = " + curRotation);
                        updateRotation(curRotation);
                    }
                    else if (is360)
                    {
                        curRotation -= 36;
                        //curRotation -= (Time.deltaTime * dodgeSpeed);
                        if (curRotation < 0)
                        {
                            curRotation += 360;
                        }
                        updateRotation(curRotation);
                    }
                }

                if (Input.GetKeyDown(KeyCode.D) || Input.GetKeyDown(KeyCode.RightArrow) || Input.GetAxis("AxisX") <= -.1f)
                {
                    if (!is360 && (gameObject.transform.eulerAngles.z > 334 || gameObject.transform.eulerAngles.z < 26))
                    {
                        curRotation += (Time.deltaTime * dodgeSpeed);
                        if (curRotation < -26 || curRotation > 26)
                        {
                            curRotation = 24.9f;
                        }
                        updateRotation(curRotation);
                    }
                    else if (is360)
                    {
                        curRotation += 36;
                        //curRotation += (Time.deltaTime * dodgeSpeed);
                        if (curRotation > 360)
                        {
                            curRotation -= 360;
                        }
                        updateRotation(curRotation);
                    }
                }
            }
            else if (movementHeldTimer >= movementHeldTimerValue)
            {
                if ((Input.GetKey(KeyCode.A) || Input.GetKey(KeyCode.LeftArrow)) || Input.GetAxis("AxisX") >= .1f && constantTransitionTimer > constantTransitionTimerValue)
                {
                    if (!is360 && (gameObject.transform.eulerAngles.z > 334 || gameObject.transform.eulerAngles.z < 26))
                    {
                        curRotation -= (Time.deltaTime * dodgeSpeed);
                        if (curRotation < -26 || curRotation > 26)
                        {
                            curRotation = -24.9f;
                        }
                        //Debug.Log("curRotation = " + curRotation);
                        updateRotation(curRotation);
                    }
                    else if (is360)
                    {
                        curRotation -= 36;
                        //curRotation -= (Time.deltaTime * dodgeSpeed);
                        if (curRotation < 0)
                        {
                            curRotation += 360;
                        }
                        updateRotation(curRotation);
                    }
                    constantTransitionTimer = 0;
                }

                if ((Input.GetKey(KeyCode.D) || Input.GetKey(KeyCode.RightArrow) || Input.GetAxis("AxisX") <= -.1f) && constantTransitionTimer > constantTransitionTimerValue)
                {
                    if (!is360 && (gameObject.transform.eulerAngles.z > 334 || gameObject.transform.eulerAngles.z < 26))
                    {
                        curRotation += (Time.deltaTime * dodgeSpeed);
                        if (curRotation < -26 || curRotation > 26)
                        {
                            curRotation = 24.9f;
                        }
                        updateRotation(curRotation);
                    }
                    else if (is360)
                    {
                        curRotation += 36;
                        //curRotation += (Time.deltaTime * dodgeSpeed);
                        if (curRotation > 360)
                        {
                            curRotation -= 360;
                        }
                        updateRotation(curRotation);
                    }
                    constantTransitionTimer = 0;
                }
            }
        }
        #endregion

        #region notSnapMovement
        if (!isSnapMovement)
        {
            if (Input.GetKey(KeyCode.A) || Input.GetKey(KeyCode.LeftArrow) || Input.GetAxis("AxisX") >= .1f)
            {
                if (is360)//needs to be not an 'else if' only an if by itself - John
                {
                    curRotation -= (Time.deltaTime * dodgeSpeed);
                    if (curRotation < 0)
                    {
                        curRotation += 360;
                    }
                    updateRotation(curRotation);
                }
            }
            else if (Input.GetKey(KeyCode.D) || Input.GetKey(KeyCode.RightArrow) || Input.GetAxis("AxisX") <= -.1f)
            {
                if (is360)//needs to be not an 'else if' only an if by itself - John
                {
                    curRotation += (Time.deltaTime * dodgeSpeed);
                    if (curRotation > 360)
                    {
                        curRotation -= 360;
                    }
                    updateRotation(curRotation);
                }
            }
        }
        #endregion

        if (!Input.GetKey(KeyCode.A) && !Input.GetKey(KeyCode.D) && !Input.GetKey(KeyCode.LeftArrow) && !Input.GetKey(KeyCode.RightArrow))
        {
            movementHeldTimer       = 0;
            constantTransitionTimer = 0;
            if (!isSnapMovement && doCentering)
            {
                centerPlayer();
            }
        }

/*
 *      if (Input.GetKey(KeyCode.W) || Input.GetKey(KeyCode.UpArrow) || Input.GetAxis("AxisY") >= .1f)										// speed increase
 *      {
 * //			emissionRate += Time.deltaTime;						// If the W key is being pressed, increase
 *                      speedMod = 5f;
 *      }
 *      if (Input.GetKey(KeyCode.S) || Input.GetKey(KeyCode.DownArrow) || Input.GetAxis("AxisY") <= -.1f)										// speed Decrease
 *      {
 *          speedMod = .5f;
 *      }
 */     // end accel and brake system


        PenguinData penguinData = GameObject.Find("Penguin").GetComponent <PenguinData>();
//		DifficultySpawner difficultySpawner = GameObject.Find("SpawnerEasy").GetComponent<DifficultySpawner>();
        PenguinDirectory penguinDirectory = GameObject.Find("Penguin").GetComponent <PenguinDirectory>();
//		movementSpeed = speedMod + (penguinData.difficultyIndex * (penguinData.score + penguinDirectory.SpawnTimeMin)) / penguinData.score;
    }
 // Use this for initialization
 void Start()
 {
     PenguinInfoHolder = GetComponent <PenguinData>();
     //speedupParticleSystem = GameObject.Find ("SpeedUp Particle").GetComponent<ParticleSystem>();
     //emissionModule = speedupParticleSystem.GetComponent<ParticleSystem> ().emission;
 }
 public void Init(PenguinData pData)
 {
     Data            = pData;
     gameObject.name = "Penguin - " + Data.Name;
     //GetComponent<SpriteRenderer>().color = Data.Color;
 }
示例#13
0
    public void GameUpdate(PenguinData charData, InputsManager input, ref Data data, Settings settings, World world)
    {
        wandangle = charData.wandAngle;

        bool movingRight = (data.xPush < -0.001f);
        bool movingLeft  = (data.xPush > 0.001f);

        if (movingRight)
        {
            penguinRenderer.flipX = false;
        }
        else if (movingLeft)
        {
            penguinRenderer.flipX = true;
        }

        if (input.quak)
        {
            anime.PlayInFixedTime("idle");
            world.quack.Play();
        }


        if (input.actionButton)
        {
            if (wandangle >= -30 && wandangle < 30)
            {
                penguinRenderer.flipX = false;
                anime.PlayInFixedTime(forward);
                animationCurrent = forward;
            }
            else if (wandangle >= 30 && wandangle < 60)
            {
                penguinRenderer.flipX = false;
                anime.PlayInFixedTime(dforward);
                animationCurrent = dforward;
            }
            else if (wandangle >= 60 && wandangle < 120)
            {
                penguinRenderer.flipX = false;
                anime.PlayInFixedTime(upward);
                animationCurrent = upward;
            }
            else if ((wandangle >= 120 && wandangle < 150))
            {
                penguinRenderer.flipX = true;
                anime.PlayInFixedTime(dforward);
                animationCurrent = dforward;
            }
            else if (wandangle >= 150 || wandangle < -150)
            {
                penguinRenderer.flipX = true;
                anime.PlayInFixedTime(forward);
                animationCurrent = forward;
            }

            data.disableWalk   = true;
            disableWalkingAnim = true;
            StopAllCoroutines();
            StartCoroutine(forward_pose());
        }


        // Enemy deaths

        int alienPoolLen = world.alienPool.Count;

        for (int i = 0; i < alienPoolLen; i++)
        {
            Alien movingAlien = world.alienPool[i];

            if (!movingAlien.active)
            {
                continue;
            }

            Vector3 alienPosition = movingAlien.transform.localPosition;

            float xDist    = (alienPosition.x - this.transform.localPosition.x);
            float yDist    = (alienPosition.y - this.transform.localPosition.y);
            float distance = xDist * xDist + yDist * yDist;

            if (distance < 0.8f)
            {
                world.gameOver.Play();
                // Debug.Log("dead");
                anime.PlayInFixedTime(die);
                data.gameStatus = GameState.GAME_OVER;
            }
            else
            {
                //Debug.Log("alive");
            }
        }



        if (disableWalkingAnim)
        {
            return;
        }

        data.disableWalk = false;

        movingRight = (input.movement.x > 0) || (data.xPush < -0.001f);
        movingLeft  = (input.movement.x < 0) || (data.xPush > 0.001f);

        if (movingRight)
        {
            penguinRenderer.flipX = false;
            if (animationCurrent != walk)
            {
                anime.Play(walk);
                animationCurrent = walk;
                // Debug.Log("walllll");
            }
        }
        else if (movingLeft)
        {
            penguinRenderer.flipX = true;
            if (animationCurrent != walk)
            {
                anime.Play(walk);
                animationCurrent = walk;
                Debug.Log("walllll");
            }
        }
        else
        {
            if (animationCurrent != idle)
            {
                anime.Play(idle);
                animationCurrent = idle;
                Debug.Log("idl");
            }
        }
    }