Ejemplo n.º 1
0
 private void Move()
 {
     if (_currentDistance <= 0)
     {
         
         if (transform.position.x > 1f)
         {
             _playerPossition = Possition.right;
             _dirrection = _dirrection == 1 ? 0 : _dirrection;
         }
         else if (transform.position.x < -1f)
         {
             _playerPossition = Possition.left;
             _dirrection = _dirrection == -1 ? 0 : _dirrection;
         }
         else
         {
             _playerPossition = Possition.middle;
             transform.position = new Vector3(0, 0, transform.position.z);
         }
         _playerCondition = PlayerCondition.run;
         return;
     }
     float speed = Distance / AnimationTime;
     float tmpDist = Time.deltaTime * speed;
     _characterController.Move(Vector3.right * _currentDirrection * tmpDist);
     _currentDistance -= tmpDist;
 }
Ejemplo n.º 2
0
    override protected void Start()
    {
        base.Start();

        body = GetComponent <Rigidbody2D>();
        Debug.Assert(body != null, "could not find player collider");

        collider = GetComponent <Collider2D>();
        Debug.Assert(collider != null, "could not find player collider");

        input = GetComponent <InputRouter>();
        Debug.Assert(collider != null, "could not find input router");

        playerCondition = GetComponent <PlayerCondition>();
        Debug.Assert(playerCondition != null, "could not find playerCondition");

        animationManager = GetComponent <AnimationManager>();
        Debug.Assert(animationManager != null, "could not find animationManager");

        groundTester = transform.Find("GroundTester")?.GetComponent <GroundTester>();
        Debug.Assert(groundTester != null, "could not find groundTester");

        Debug.Log(name + " " + walkGroundSpeed);

        //Physics2D.gravity = Vector2.zero;
        Debug.Log(name + " " + playerCondition);
        WallDetachState = WallDetach.CONTROL;
        Rebase();
    }
Ejemplo n.º 3
0
 public PlayerStateInfo(PlayerState ps)
 {
     Condition = ps.Condition;
     Mode      = ps.Mode;
     Comment   = ps.Comment;
     Score     = ps.Score;
 }
Ejemplo n.º 4
0
    new void Start()
    {
        base.Start();

        body = GetComponent <Rigidbody2D>();
        Debug.Assert(body != null, "could not find player collider");

        collider = GetComponent <Collider2D>();
        Debug.Assert(collider != null, "could not find player collider");

        input = GetComponent <InputRouter>();
        Debug.Assert(collider != null, "could not find input router");

        playerCondition = GetComponent <PlayerCondition>();
        Debug.Assert(playerCondition != null, "could not find playerCondition");

        animationManager = GetComponent <AnimationManager>();
        Debug.Assert(animationManager != null, "could not find animationManager");

        lifeManager = GetComponent <LifeManager>();
        Debug.Assert(lifeManager != null, "could not find lifeManager");

        Physics2D.gravity = Vector2.zero;

        WallDetachState = WallDetach.CONTROL;
        Rebase();
    }
    public void SwitchPausedUnpaused()
    {
        if (_inPausedState)//выходим из паузы
        {
            _screenFilterImage.color          = _savedUnpausedColor;
            _playerController.playerCondition = _savedUnpausedPlayerCondition;

            SwitchButtonsOnOff();

            Time.timeScale = 1;
        }
        else//ставим на паузу
        {
            _savedUnpausedColor      = _screenFilterImage.color;
            _screenFilterImage.color = _pauseScreenColor;

            _savedUnpausedPlayerCondition     = _playerController.playerCondition;
            _playerController.playerCondition = PlayerCondition.uncontrollable;

            SwitchButtonsOnOff();

            Time.timeScale = 0;
        }

        _inPausedState = !_inPausedState;
    }
Ejemplo n.º 6
0
 protected new void Start()
 {
     base.Start();
     playerMovementGround = GetComponent <PlayerMovementGround>();
     playerCondition      = GetComponent <PlayerCondition>();
     Debug.Assert(playerMovementGround != null, "CommandCharge needs player movement ground");
 }
    IEnumerator Transformation()
    {
        if (!_isTransformating)
        {
            _soundManager.Transformation();

            _isTransformating = true;
            _leafCount        = 0;
            playerCondition   = PlayerCondition.uncontrollable;

            // Animation
            _animation.SwitchEvolutionStage();

            yield return(new WaitForSeconds(transformationTime));

            // Animation
            _animation.SwitchEvolutionStage();
            _soundManager.PlaySound("TransformationEnd");
            yield return(new WaitForSeconds(transformationExitTime));

            playerCondition = PlayerCondition.butterfly;

            _youCanFlyNotificationTrigger.SetActive(true);

            // Animation
            _animation.SwitchEvolutionStage();
        }
    }
Ejemplo n.º 8
0
 // Start is called before the first frame update
 void Start()
 {
     player       = GameObject.FindWithTag("Player").transform;
     damagePlayer = GameObject.FindWithTag("Player").GetComponent <PlayerCondition>();
     rb           = this.GetComponent <Rigidbody2D>();
     anim         = GetComponent <Animator>();
 }
Ejemplo n.º 9
0
    // Use this for initialization
    void Start()
    {
        //Set color of healthbar to green
        healthIndicator.color = Color.green;

        pCondition = GameObject.FindGameObjectWithTag("Player").GetComponent <PlayerCondition>();

        if (opponentType == OpponentType.GK)
        {
            speed = 2;
        }
        else
        {
            speed = Random.Range(0.1f, 1.5f);
        }

        isActive  = false;
        animator  = GetComponent <Animator>();
        health    = initialHealth;
        stunClock = 0.5f;
        isStunned = true;
        healthIndicator.fillAmount = 1;
        StartCoroutine("CheckPunchPlayer");
        isChasing = false;
    }
Ejemplo n.º 10
0
 new void Start()
 {
     base.Start();
     playerCondition  = GetComponent <PlayerCondition>();
     body             = GetComponent <Rigidbody2D>();
     animationManager = GetComponent <AnimationManager>();
 }
Ejemplo n.º 11
0
 // Use this for initialization
 void Start()
 {
     this.audio         = gameObject.GetComponent <AudioSource> ();
     this.image         = gameObject.GetComponent <Image> ();
     this.currentSprite = this.sprites [0];
     this.player        = GameObject.Find("Player");
     this.pc            = this.player.GetComponent <PlayerCondition> ();
 }
Ejemplo n.º 12
0
    // Use this for initialization
    void Start()
    {
        target = GameObject.Find("Player").transform;
        agent  = GetComponent <NavMeshAgent> ();
        dest   = agent.destination;

        pc = GameObject.Find("Player").GetComponent <PlayerCondition> ();
    }
Ejemplo n.º 13
0
 public ChangeStatusEvent(PartyMemberId partyMemberId, NumericOperation operation, ushort amount, PlayerCondition status, byte unk3)
 {
     PartyMemberId = partyMemberId;
     Operation     = operation;
     Amount        = amount;
     Status        = status;
     Unk3          = unk3;
 }
Ejemplo n.º 14
0
 // Use this for initialization
 void Start()
 {
     animator     = GetComponent <Animator>();
     myRB         = GetComponent <Rigidbody2D>();
     pCondition   = GetComponent <PlayerCondition>();
     sprite       = GetComponent <SpriteRenderer>();
     punchTimer   = 0;
     matchRunning = false;
     audioPlayer  = GetComponent <AudioSource>();
 }
Ejemplo n.º 15
0
 private void OnTriggerEnter(Collider other)
 {
     
     if (other.CompareTag("Barrier"))
     {
         WorldController.instanse.Speed = 0;
         _animator.SetTrigger("Death");
         _playerCondition = PlayerCondition.dead;
     }
 }
        public void NextCycle()
        {
            if (!DaggerfallUnity.Settings.NearDeathWarning ||
                DaggerfallUI.Instance.FadeBehaviour.FadeInProgress ||
                Parent.BackgroundColor.a > 0.9f)    // prevents conflict with fade in from black
            {
                return;
            }

            PlayerCondition condition = GetPlayerCondition();

            if (vitalsDetector.HealthLost > 0 && flickerFast.IsTimedOut)
            {
                flickerFast.Init();
            }

            if (vitalsDetector.HealthGain > 0 && condition != PlayerCondition.Wounded)
            {
                flickerSlow.IsTimedOut = true;
            }

            Color backColor;

            switch (condition)
            {
            case PlayerCondition.Injured:
                flickerFast.Cycle();
                backColor = new Color(flickerFast.RedValue, 0, 0, flickerFast.AlphaValue);
                break;

            case PlayerCondition.Wounded:
                flickerFast.Cycle();
                // Flicker slow runs if flickerFast is timed out, and cannot if it isn't timed out
                flickerSlow.IsTimedOut = !flickerFast.IsTimedOut;
                flickerSlow.Cycle();
                if (flickerFast.IsTimedOut)
                {
                    backColor = new Color(flickerSlow.RedValue, 0, 0, flickerSlow.AlphaValue);
                }
                else
                {
                    backColor = new Color(flickerFast.RedValue, 0, 0, flickerFast.AlphaValue);
                }
                break;

            default:
                backColor = new Color();
                break;
            }

            if (condition != PlayerCondition.Dead && backColor != Parent.BackgroundColor)
            {
                Parent.BackgroundColor = backColor;
            }
        }
Ejemplo n.º 17
0
 public void Attack()
 {
     if (UIcontroller.instanse.GetPoint() > 0 )
     {
         if (_playerCondition != PlayerCondition.attack && _playerCondition == PlayerCondition.run)
         {
             _playerCondition = PlayerCondition.attack;
             _animator.SetTrigger("Attack");
         }
     }
     
 }
Ejemplo n.º 18
0
 // Use this for initialization
 virtual protected void Start()
 {
     input               = GetComponent <InputRouter>();
     playerId            = input.PlayerId;
     playerMovement      = GetComponent <PlayerMovement>();
     playerMana          = GetComponent <PlayerMana>();
     animationManager    = GetComponent <AnimationManager>();
     playerCondition     = GetComponent <PlayerCondition>();
     tintManager         = GetComponent <TintManager>();
     playerStatusDisplay = transform.Find("StatusCanvas")?.GetComponent <PlayerStatusDisplay>();
     // Debug.Log("playerstatusdisplau"  + playerStatusDisplay);
 }
Ejemplo n.º 19
0
 public void ResetGame()
 {
     playerScore  = 0;
     MyWallSpeed  = setWallSpeed;
     count        = -1;
     currentValue = 0;
     startedGame  = false;
     BodyManager.instance.PrepareForNextGame();
     Destroy(removeableGameOverWall);
     playerCondition    = PlayerCondition.Perfect;
     fill.color         = safeColor;
     handle.localScale  = normalSizedHandle;
     handleSprite.color = handleDefault;
 }
Ejemplo n.º 20
0
    void ManagePanicBar()
    {
        handlePumpDuration = 1;
        fill.color         = Color.Lerp(safeColor, dangerColor, slider.value);
        float lerp = Mathf.PingPong(Time.time, handlePumpDuration) / handlePumpDuration;

        handleSprite.color = Color.Lerp(handleDefault, handleGone, lerp);

        if (slider.value > 0.8f)
        {
            playerCondition = PlayerCondition.Losing;

            handle.localScale = Vector3.Lerp(normalSizedHandle, largeSizedHandle, lerp);

            if (Time.frameCount % 40 == 0)
            {
                SoundManager.instance.PlaySound("heartBeat");
            }

            return;
        }

        else if (slider.value > 0.6f)
        {
            playerCondition   = PlayerCondition.Poor;
            handle.localScale = Vector3.Lerp(normalSizedHandle, largeSizedHandle, lerp);

            if (Time.frameCount % 240 == 0)
            {
                SoundManager.instance.PlaySound("heartBeat");
            }

            return;
        }

        else if (slider.value > 0.4f)
        {
            playerCondition = PlayerCondition.Good;
            return;
        }

        else if (slider.value > 0.2f)
        {
            playerCondition = PlayerCondition.Excellent;
            return;
        }

        playerCondition = PlayerCondition.Perfect;
    }
Ejemplo n.º 21
0
    void Awake()
    {
        foreach (var t in GameObject.FindGameObjectsWithTag("Planetary"))
        {
            if (!planets.Contains(t))
            {
                planets.Add(t);
            }
        }

        post = GetComponent <PostProcessingBehaviour>();

        if (player != null)
        {
            condition = player.GetComponent <PlayerCondition>();
        }
    }
Ejemplo n.º 22
0
    // Init
    void Start()
    {
        this.velocity   = Vector3.zero;
        this.rotation_x = Vector3.zero;
        this.rotation_y = 0f;
        this.jump       = Vector3.zero;

        this.rb = GetComponent <Rigidbody>();

        this.camera_rotation_limit = 78f;
        this.current_rotation_y    = 0f;

        this.p_setup = GetComponent <PlayerSetup>();
        this.p_cond  = GetComponent <PlayerCondition>();

        this.camera_def_pos = camera.transform.position;
    }
Ejemplo n.º 23
0
    private string ConditionToString(PlayerCondition cond)
    {
        switch (cond)
        {
        case PlayerCondition.NONE:
            return("NONE");

        case PlayerCondition.SAFE:
            return("SAFE");

        case PlayerCondition.CAPTURED:
            return("CAPTURED");

        default:
            return("");
        }
    }
Ejemplo n.º 24
0
 public void Jump() 
 {
     float tmpDist = Time.deltaTime * (1.5f / 0.45f);
     if (_currentDistance <= 0)
     {
         _characterController.Move(Vector3.down * tmpDist);
         if (transform.position.y <= 0.1f)
         {
             transform.position = new Vector3(transform.position.x, 0, transform.position.z);
             _playerCondition = PlayerCondition.run;
         }
     }
     else 
     {
         _characterController.Move(Vector3.up * tmpDist);
         _currentDistance -= tmpDist;
     }
 }
Ejemplo n.º 25
0
    override protected void Start()
    {
        base.Start();

        body = GetComponent <Rigidbody2D>();
        Debug.Assert(body != null, "could not find player collider");

        collider = GetComponent <Collider2D>();
        Debug.Assert(collider != null, "could not find player collider");

        input = GetComponent <InputRouter>();
        Debug.Assert(collider != null, "could not find input router");

        playerCondition = GetComponent <PlayerCondition>();
        Debug.Assert(playerCondition != null, "could not find playerCondition");

        animationManager = GetComponent <AnimationManager>();
        Debug.Assert(animationManager != null, "could not find animationManager");

        groundTester = transform.Find("GroundTester")?.GetComponent <GroundTester>();
        Debug.Assert(groundTester != null, "could not find groundTester");

        normalTester = transform.Find("NormalTester")?.GetComponent <NormalTester>();
        Debug.Assert(normalTester != null, "could not find NormalTester");

        crouchBlocker = transform.Find("CrouchBlocker")?.GetComponent <CrouchBlocker>();
        Debug.Assert(crouchBlocker != null, "could not find CrouchBlocker");

        Debug.Log(name + " " + walkGroundSpeed);

        //Search Particle system
        Transform pxBlob = transform.Find("PxBlobs");

        Debug.Assert(pxBlob != null, "could not find PxBlobs");
        Transform rabbits = pxBlob.transform.Find("Rabbits");

        Debug.Assert(rabbits != null, "could not find Rabbits");
        partSystem = rabbits.GetComponent <ParticleSystem>();

        //Physics2D.gravity = Vector2.zero;
        Debug.Log(name + " " + playerCondition);
        WallDetachState = WallDetach.CONTROL;
        Rebase();
    }
Ejemplo n.º 26
0
    new void Start()
    {
        base.Start();

        body = GetComponent <Rigidbody2D>();
        Debug.Assert(body != null, "could not find player collider");

        collider = GetComponent <Collider2D>();
        Debug.Assert(collider != null, "could not find player collider");

        input = GetComponent <InputRouter>();
        Debug.Assert(collider != null, "could not find input router");


        playerCondition = GetComponent <PlayerCondition>();
        Debug.Assert(playerCondition != null, "could not find playerCondition");

        IsWallDetached = true;
        Rebase();
    }
    IEnumerator HealthManagment()
    {
        GameDataManager.Instance.GUIManager.HealthBar.maxValue = _maxHealth;
        _health = _maxHealth;
        int wetness = 0;

        while (Condition == PlayerCondition.Alive)
        {
            switch (WetnessCondition)
            {
            case WetnessCondition.Dry:
                _health = Mathf.Min(_maxHealth, _health + 10);
                wetness = 0;
                break;

            case WetnessCondition.Wet:
                wetness++;
                if (wetness > 3)
                {
                    _manager.PlayerAudioManager.AudioWasHitSource.PlayRandom();
                    _health -= 25;
                    GameDataManager.Instance.GUIManager.HealthBar.value = _health;
                    if (_health <= 0)
                    {
                        _manager.PlayerAnimationManager.AnimationToDeath(true);
                        Condition = PlayerCondition.Dead;
                        GameDataManager.Instance.GUIManager.ActivatePause();
                    }
                }

                break;

            default:
                throw new ArgumentOutOfRangeException();
            }

            GameDataManager.Instance.GUIManager.HealthBar.value = _health;
            yield return(new WaitForSeconds(1));
        }
    }
Ejemplo n.º 28
0
    void Update()
    {
        _dirrection = SetDirection();

        if (_playerCondition == PlayerCondition.run && _dirrection != 0)
        {
            _playerCondition = PlayerCondition.moving; 
            _currentDirrection = _dirrection;
            _currentDistance = Distance;

            if (_dirrection == -1)
            {
                _animator.SetTrigger("Left");
            }
            if (_dirrection == 1)
            {
                _animator.SetTrigger("Right");
            }
            if (_dirrection == 2 )
            {
                _currentDistance = 1.5f;
                _animator.SetTrigger("Flip");
                _playerCondition = PlayerCondition.jump;
            }

        }
        if (_playerCondition == PlayerCondition.moving)
        {
            Move();
        }
        if (_playerCondition == PlayerCondition.jump)
        {
            Jump();
        }
        if (_playerCondition == PlayerCondition.attack)
        {
            Attack();
        }

    }
Ejemplo n.º 29
0
 public void ApplyDamage(int damage) // получение урона
 {
     PlayerCurrentHealth -= damage;
     if (PlayerCurrentHealth < 0)
     {
         PlayerCurrentHealth = 0;
     }
     if (PlayerCurrentHealth == 0)
     {
         Condition = PlayerCondition.Мертв;
     }
     if (PlayerCurrentHealth < 10 && PlayerCurrentHealth > 0)
     {
         Condition = PlayerCondition.Ослаблен;
     }
     if (PlayerCurrentHealth >= 10)
     {
         Condition = PlayerCondition.Здоров;
     }
     if (PlayerCurrentHealth > PlayerMaxHealth)
     {
         PlayerCurrentHealth = PlayerMaxHealth;
     }
 }
Ejemplo n.º 30
0
 // Use this for initialization
 void Start()
 {
     this.image  = GetComponent <Image> ();
     this.player = GameObject.Find("Player");
     this.pc     = this.player.GetComponent <PlayerCondition> ();
 }