Esempio n. 1
0
    //private CharacterController charControler;
    // Use this for initialization
    void Start()
    {
        //Debug.Log("Start Robot");
        generalMoveSpeed = GameWorld.Instance.MoveSpeed;
        jumpHeight = GameWorld.Instance.JumpHeight;
        currentDirection = new Vector3(generalMoveSpeed,0,0);
        gravity = GameWorld.Instance.Gravity;
        jumpingGravity = GameWorld.Instance.JumpGravity;
        currentSpeed = generalMoveSpeed;
        increaseSteps = GameWorld.Instance.SpeedIncreaseStep;
        decreaseSteps = GameWorld.Instance.SpeedDecreaseStep;
        minSpeed = GameWorld.Instance.MinSpeed;
        maxSpeed = GameWorld.Instance.MaxSpeed;
        currentState = GameWorld.Instance.Emotions.GetState(currentSpeed);
        targetTumbleTime = 0;
        timeTumbling = 0;
        lastState = currentState;
        AfterTumbling = false;
        afterTumblingSpeedUp = GameWorld.Instance.AfterTumblingSpeedUp;
        jumping = false;
        movieTexture = gameObject.GetComponent<AnimatedUVBehaviour>() as AnimatedUVBehaviour;
        standardFrameRate = movieTexture.MovieSpeedFPS;
        lastPosition = currentDirection;
        standardRotation = gameObject.transform.rotation;
        movieTexture.Textures[0] = sadTexture;
        movieTexture.ReloadTexture();

        sound = gameObject.GetComponent<AudioSource>() as AudioSource;

        Torso.gameObject.renderer.enabled = false;
        Leg1.gameObject.renderer.enabled = false;
        Leg2.gameObject.renderer.enabled = false;
        Arm1.gameObject.renderer.enabled = false;
        Arm2.gameObject.renderer.enabled = false;
        Head.gameObject.renderer.enabled = false;

        charControler = GetComponent<CharacterController>();
    }
Esempio n. 2
0
    private void checkEmotionState()
    {
        // Just a Dummy
        currentState = GameWorld.Instance.Emotions.GetState(currentSpeed);
        //Debug.Log("currentState: " + currentState);
        if(lastState != currentState){
            if(currentState == EmotionStates.States.TooFast){
                Debug.Log("Reached To Fast");
                IncreaseSpeed(maxSpeed);
                // Do Graphic Changes here
                if(ChangeToTooFast != null){
                    sound.clip =  ChangeToTooFast;
                    sound.Play();
                }

                if(!duringHit){
                    movieTexture.Textures[0] = crazyTexture;
                    movieTexture.ReloadTexture();
                }

            } else if(currentState == EmotionStates.States.TooSlow){
                Debug.Log("Reached Too Slow");
                DecreaseSpeed(maxSpeed);
                if(ChangeToTooSlow != null){
                    sound.clip =  ChangeToTooSlow;
                    sound.Play();
                }
                // Do Graphic Changes here
                if(!duringHit){
                    movieTexture.Textures[0] = sadTexture;
                    movieTexture.ReloadTexture();
                }
            } else{
                if(ChangeToTooNormal != null){
                    sound.clip =  ChangeToTooNormal;
                    sound.Play();
                }
                if(!duringHit){
                    movieTexture.Textures[0] = normalTexture;
                    movieTexture.ReloadTexture();
                }
            }

            lastState = currentState ;
        }
    }