Beispiel #1
0
    private IEnumerator Start()
    {
        PlayerMovement      movement     = SceneController.Instance.GetMainPlayerMovement();
        GameObject          playerCamera = movement.playerCamera;
        GameObject          body         = movement.body;
        CharacterController controller   = movement.controller;

        // Wait for the specified delay
        yield return(new WaitForSeconds(Delay));

        StressReceiver receiver = playerCamera.GetComponent <StressReceiver>();
        float          elapsed  = 0;

        body.SetActive(false);
        controller.enabled = false;

        while (elapsed < Duration)
        {
            float distance = Vector3.Distance(transform.position, playerCamera.transform.position);

            float distance01 = Mathf.Clamp01(distance / Range);
            float stress     = (1 - Mathf.Pow(distance01, 2)) * MaximumStress;
            receiver.InduceStress(stress);

            elapsed += Time.deltaTime;
            yield return(null);
        }

        yield return(new WaitForSeconds(1.0f));

        body.SetActive(true);
        receiver.enabled   = false;
        controller.enabled = true;
    }
Beispiel #2
0
 public void GetHit()
 {
     balloons -= 1;
     GetStunned(0.5f, new Vector2(transform.forward.x, transform.forward.z), 700);
     _pVar.MaxSpeed = 100;
     StressReceiver.InduceStress(30f);
     StartCoroutine(changeKnife());
 }
Beispiel #3
0
 private void Start()
 {
     projectileData  = ProjectileManager.Instance.GetProjectileData(typeOfProjectile);
     distFromTarget  = (targetObj.position - transform.position).magnitude;
     targetImpactETA = distFromTarget / projectileData.speed;
     stressReceiver  = Camera.main.GetComponent <StressReceiver>();
     targetObjRB     = targetObj.GetComponent <Rigidbody>();
     waitTime        = projectileData.waitTime;
 }
Beispiel #4
0
 private void Start()
 {
     if (isBoss == true)
     {
         StartCoroutine("FireStart");
     }
     HelthBar[] oponenthealthbars1 = GetComponentsInChildren <HelthBar>();
     foreach (HelthBar thehealth in oponenthealthbars1)
     {
         thehealth.SetMaxHealth(maxHealth);
         thehealth.gameObject.SetActive(true);
         thehealth.transform.parent.gameObject.SetActive(true);
         healthbar = thehealth;
     }
     foreach (damage Damagemultiplyer in GetComponentsInChildren <damage>())
     {
         Damagemultiplyer.multiplyer = 0.5f;
     }
     camerashake = FindObjectOfType <Camera>().GetComponent <StressReceiver>();
     OnFireParticles.Stop();
     FireParticles.Stop();
     psIce.Stop();
     readytofire         = true;
     springjoint.enabled = false;
     FollowMouse[] followMouse = GetComponentsInChildren <FollowMouse>();
     foreach (FollowMouse FollowTheMouse in followMouse)
     {
         FollowTheMouse.enabled = true;
     }
     springjoint = GetComponentInChildren <SpringJoint2D>();
     cam         = FindObjectOfType <Camera>();
     //healthbar = GameObject.FindGameObjectWithTag("OwnHealthBar").GetComponent<HelthBar>();
     //GameObject[] oponenthealthbars = GameObject.FindGameObjectsWithTag("OponentsHealthbar");
     //foreach (GameObject thehealth in oponenthealthbars)
     //{
     //thehealth.SetActive(true);
     //healthbar = thehealth.GetComponentInChildren<HelthBar>();
     //}
     currentHealth = maxHealth;
     healthbar.SetMaxHealth(maxHealth);
     Rigidbody2D[] Gravity01 = GetComponentsInChildren <Rigidbody2D>();
     SaveJumpForce = jumpForce;
     if (!photonView.isMine)
     {
         Rigidbody2D[] rbChildren = GetComponentsInChildren <Rigidbody2D>();
         foreach (Rigidbody2D RBCHILDREN in rbChildren)
         {
             RBCHILDREN.isKinematic  = true;
             RBCHILDREN.gravityScale = 0;
         }
     }
 }
Beispiel #5
0
    /// <summary>
    /// Camera shake controller
    /// </summary>
    /// <returns></returns>
    IEnumerator ShakeyCameraCR(float durationOfShake, float shakeLevel)
    {
        while (durationOfShake > 0 && !gameOver)
        {
            durationOfShake -= Time.deltaTime * 2;
            StressReceiver sr = Camera.main.GetComponent <StressReceiver>();
            if (sr != null)
            {
                sr.InduceStress(shakeLevel);
            }
            yield return(new WaitForSeconds(0.2f));

            yield return(null);
        }
    }
 void Update()
 {
     if (Input.GetMouseButtonDown(0))
     {
         anim.SetTrigger("Active");
         m_someOtherScriptOnAnotherGameObject = GameObject.FindObjectOfType(typeof(StressReceiver)) as StressReceiver;
         m_someOtherScriptOnAnotherGameObject.InduceStress(0.2f);
         //anim.ResetTrigger("Active");
     }
     if (Input.GetMouseButtonDown(1))
     {
         anim.SetTrigger("Pulling");
         m_someOtherScriptOnAnotherGameObject = GameObject.FindObjectOfType(typeof(StressReceiver)) as StressReceiver;
         m_someOtherScriptOnAnotherGameObject.InduceStress(0.2f);
         //anim.ResetTrigger("Active");
     }
 }
Beispiel #7
0
    private void Start()
    {
        if (MenuController.power == 3)
        {
            damage[] dammage = GetComponentsInChildren <damage>();
            foreach (damage DAMAGE in dammage)
            {
                DAMAGE.multiplyer = 0.8f;
            }
        }
        GameObject[] players = GameObject.FindGameObjectsWithTag("Player");
        ownplayernumber = players.Length;
        if (MenuController.power == 2)
        {
            maxEnergy = 50;
        }
        dashCount = startDashCount;

        camerashake = FindObjectOfType <Camera>().GetComponent <StressReceiver>();
        if (MenuController.power == 3 && photonView.isMine)
        {
            maxHealth     += 50;
            SaveJumpForce += 1000;
            jumpForce     += 1000;
            FollowMouse[] thefollowMouse = GetComponentsInChildren <FollowMouse>();
            foreach (FollowMouse FollowTheMouse in thefollowMouse)
            {
                FollowTheMouse.Maxspeed += 10;
            }
            Rigidbody2D[] rbChildren = GetComponentsInChildren <Rigidbody2D>();
            foreach (Rigidbody2D RBCHILDREN in rbChildren)
            {
                RBCHILDREN.mass += 0.1f;
            }
        }
        OnFireParticles.Stop();
        FireParticles.Stop();
        psIce.Stop();
        if (MenuController.power == 2 && photonView.isMine)
        {
            SpriteRenderer[] Transparency = GetComponentsInChildren <SpriteRenderer>();
            foreach (SpriteRenderer theTransparency in Transparency)
            {
                theTransparency.color = new Color(0.15f, 0.15f, 0.15f, 1f);
            }
            photonView.RPC("Invisibillity", PhotonTargets.OthersBuffered);
            photonView.RPC("hidehealthbar", PhotonTargets.OthersBuffered);
        }
        if (MenuController.power == 3 && photonView.isMine)
        {
            maxEnergy -= 50;
        }
        currentEnergy       = maxEnergy;
        readytofire         = true;
        springjoint.enabled = false;
        lr.enabled          = false;
        FollowMouse[] followMouse = GetComponentsInChildren <FollowMouse>();
        foreach (FollowMouse FollowTheMouse in followMouse)
        {
            FollowTheMouse.enabled = true;
        }
        springjoint = GetComponentInChildren <SpringJoint2D>();
        cam         = FindObjectOfType <Camera>();
        if (MenuController.selectedgamemode == 2)
        {
            SpeedBar       = GameObject.FindGameObjectWithTag("SpeedBar").GetComponent <HelthBar>();
            StrenghtBar    = GameObject.FindGameObjectWithTag("StrenghtBar").GetComponent <HelthBar>();
            HealthboostBar = GameObject.FindGameObjectWithTag("HealthboostBar").GetComponent <HelthBar>();
            JumpboostBar   = GameObject.FindGameObjectWithTag("JumpboostBar").GetComponent <HelthBar>();
            HealthboostBar.SetMaxHealth(20);
            StrenghtBar.SetMaxHealth(20);
            JumpboostBar.SetMaxHealth(20);
            SpeedBar.SetMaxHealth(20);
            HealthboostBar.SetHealth(0);
            StrenghtBar.SetHealth(0);
            JumpboostBar.SetHealth(0);
            SpeedBar.SetHealth(0);
        }
        healthbar = GameObject.FindGameObjectWithTag("OwnHealthBar").GetComponent <HelthBar>();
        energybar = GameObject.FindGameObjectWithTag("EnergyBar").GetComponent <HelthBar>();
        GameObject[] oponenthealthbars = GameObject.FindGameObjectsWithTag("OponentsHealthbar");
        if (photonView.isMine)
        {
            energybar.SetMaxHealth(maxEnergy);
        }
        foreach (GameObject thehealth in oponenthealthbars)
        {
            if (!thehealth.GetComponent <PhotonView>().isMine)
            {
                Oponenthealthbar = thehealth.GetComponent <HelthBar>();
                thehealth.SetActive(true);
            }
            else
            {
                thehealth.SetActive(false);
            }
        }
        if (GameManager.playernumber == ownplayernumber && MenuController.selectedgamemode == 5)
        {
            Snow.Play();
        }

        jumpForce    *= 1.75f;
        currentHealth = maxHealth;
        healthbar.SetMaxHealth(maxHealth);
        if (Oponenthealthbar)
        {
            Oponenthealthbar.SetMaxHealth(maxHealth);
        }
        Rigidbody2D[] Gravity01 = GetComponentsInChildren <Rigidbody2D>();
        SaveJumpForce = jumpForce;
        if (GameManager.playernumber != 1)
        {
            Rigidbody2D[] rbChildren = GetComponentsInChildren <Rigidbody2D>();
            foreach (Rigidbody2D RBCHILDREN in rbChildren)
            {
                RBCHILDREN.isKinematic  = true;
                RBCHILDREN.gravityScale = 0;
            }
        }
        if (MenuController.selectedgamemode == 4)
        {
            maxHealth += 100;
        }
    }
 private void Awake()
 {
     _stressReceiver = StressReceiver.Instance;
 }
Beispiel #9
0
 private void Awake()
 {
     Instance = this;
 }
Beispiel #10
0
 private void Start()
 {
     camerashake = FindObjectOfType <Camera>().GetComponent <StressReceiver>();
 }