コード例 #1
0
 public void Hit(Vector2 direction, float time, float startSpeed)
 {
     state             = RoombaState.Ragdolling;
     velocityDirection = direction.normalized;
     ragdollSpeed      = startSpeed;
     ragdollTimer      = time;
 }
コード例 #2
0
 void Start()
 {
     _lockTransform = deathCanvas.transform.rotation;
     _pVar          = GetComponent <PlayerVariables>();
     _phy           = GetComponent <CustomPhysics>();
     _normalState   = new NormalState(_pVar);
     _boostState    = new BoostState(_pVar);
     _currentState  = _normalState;
     _image         = deathCanvas.GetComponentInChildren <Image>();
 }
コード例 #3
0
 void Spin()
 {
     transform.Rotate(0, 0, spinSpeed * Time.deltaTime, Space.Self);
     if (Input.GetKeyDown(stopSpinningKey))
     {
         velocityDirection = transform.up;
         moveTimer         = moveDelay;
         state             = RoombaState.Moving;
     }
 }
コード例 #4
0
    void FixedUpdate()
    {
        Debug.DrawLine(transform.position + Vector3.zero, transform.position + transform.forward, Color.red);
        Debug.DrawLine(transform.position + Vector3.zero, transform.position + new Vector3(_inputVector.x, 0, _inputVector.y), Color.green);
        Debug.DrawLine(transform.position + Vector3.zero, transform.position + new Vector3(bisector(_inputVector, transform.forward).x, 0, bisector(_inputVector, transform.forward).y), Color.blue);
        _currentState = _currentState.runFrame(this);

        if (transform.childCount <= _nChildNoBalloons)
        {
            destroyPlayer();
        }
    }
コード例 #5
0
 private void Start()
 {
     _manager = FindObjectOfType <BattleController>();
     _manager.AddPlayer(gameObject);
     _phy            = gameObject.GetComponent <CustomPhysics>();
     _col            = gameObject.GetComponent <SphereCollider>();
     _normalState    = new NormalState(_speed, _maxVel, _rotateSpeed, _mesh);
     _boostingState  = new BoostingState(_boostTime, _boostMaxSpeed, _mesh);
     _runPUState     = new RunPowerUpState(_runPUTime, _speed * _runPUSpeedMultiplier, _rotateSpeed, _mesh);
     _currentState   = _normalState;
     _currentPowerUp = new NoPowerUp();
 }
コード例 #6
0
 void Ragdoll()
 {
     transform.Translate(velocityDirection * ragdollSpeed * Time.deltaTime, Space.World);
     ragdollSpeed  = Mathf.Max(ragdollSpeed - Time.deltaTime * ragdollDecay, 0);
     ragdollTimer -= Time.deltaTime;
     if (ragdollTimer < 0 || ragdollSpeed == 0)
     {
         ragdollSpeed      = initRagdollSpeed;
         state             = RoombaState.Spinning;
         velocityDirection = Vector2.zero; // should not be used while spinning
     }
 }
コード例 #7
0
ファイル: SaverCollision.cs プロジェクト: evil9981/Hackathon
 // Use this for initialization
 void Start()
 {
     roomba_state = Camera.main.GetComponent<DisplayCollected>().roomba_state;
 }
コード例 #8
0
 public void onChangeState(RoombaState state)
 {
     _currentState = state;
     _currentState.EnterState(this);
 }
コード例 #9
0
 public void GetStunned(float v, Vector2 direction, float force)
 {
     _currentState = new StunnedState(v, direction, force);
     _currentState.EnterState(this);
     StartCoroutine(_vfx.activateStunned(v));
 }