Пример #1
0
    void Start()
    {
        cameraHook = transform;
        StartCoroutine(LazyPause());

        // validate component references
        if (computer == null) computer = GetComponent(typeof(RootMotionComputer)) as RootMotionComputer;
        if (character == null) character = GetComponent(typeof(CharacterController)) as CharacterController;

        // tell the computer to just output values but not apply motion
        computer.applyMotion = false;
        // tell the computer that this script will manage its execution
        computer.isManagedExternally = true;
        // since we are using a character controller, we only want the z translation output
        computer.computationMode = RootMotionComputationMode.ZTranslation;
        // initialize the computer
        computer.Initialize();

        // set up properties for the animations
        animation["idle_2"].layer = 0; animation["idle_2"].wrapMode = WrapMode.Loop;
        animation["walking"].layer = 1; animation["walking"].wrapMode = WrapMode.Loop;
        animation["running"].layer = 1; animation["running"].wrapMode = WrapMode.Loop;
        //animation["zombiewalk"].layer = 2; animation["zombiewalk"].wrapMode = WrapMode.Loop;

        animation.Play("idle_2");
    }
Пример #2
0
    void Start()
    {
        // validate component references
        if (computer == null)
        {
            computer = GetComponent(typeof(RootMotionComputer)) as RootMotionComputer;
        }
        if (character == null)
        {
            character = GetComponent(typeof(CharacterController)) as CharacterController;
        }

        // tell the computer to just output values but not apply motion
        computer.applyMotion = false;
        // tell the computer that this script will manage its execution
        computer.isManagedExternally = true;
        // since we are using a character controller, we only want the z translation output
        computer.computationMode = RootMotionComputationMode.ZTranslation;
        // initialize the computer
        computer.Initialize();

        // set up properties for the animations
        GetComponent <Animation>()["idle"].layer       = 0; GetComponent <Animation>()["idle"].wrapMode = WrapMode.Loop;
        GetComponent <Animation>()["sitidle"].layer    = 1; GetComponent <Animation>()["sitidle"].wrapMode = WrapMode.Loop;
        GetComponent <Animation>()["walk"].layer       = 1; GetComponent <Animation>()["walk"].wrapMode = WrapMode.Loop;
        GetComponent <Animation>()["trot"].layer       = 1; GetComponent <Animation>()["trot"].wrapMode = WrapMode.Loop;
        GetComponent <Animation>()["scratching"].layer = 1; GetComponent <Animation>()["scratching"].wrapMode = WrapMode.Loop;
        GetComponent <Animation>()["beg"].layer        = 1; GetComponent <Animation>()["beg"].wrapMode = WrapMode.Loop;
        GetComponent <Animation>()["barking"].layer    = 3; GetComponent <Animation>()["barking"].wrapMode = WrapMode.Once;
        GetComponent <Animation>()["howl"].layer       = 3; GetComponent <Animation>()["howl"].wrapMode = WrapMode.Once;

        GetComponent <Animation>().Play("sitidle");
        dogIdle = true;
    }
Пример #3
0
    void Start()
    {
        cameraHook = transform;
        StartCoroutine(LazyPause());

        // validate component references
        if (computer == null)
        {
            computer = GetComponent(typeof(RootMotionComputer)) as RootMotionComputer;
        }
        if (character == null)
        {
            character = GetComponent(typeof(CharacterController)) as CharacterController;
        }

        // tell the computer to just output values but not apply motion
        computer.applyMotion = false;
        // tell the computer that this script will manage its execution
        computer.isManagedExternally = true;
        // since we are using a character controller, we only want the z translation output
        computer.computationMode = RootMotionComputationMode.ZTranslation;
        // initialize the computer
        computer.Initialize();

        // set up properties for the animations
        animation["idle_2"].layer  = 0; animation["idle_2"].wrapMode = WrapMode.Loop;
        animation["walking"].layer = 1; animation["walking"].wrapMode = WrapMode.Loop;
        animation["running"].layer = 1; animation["running"].wrapMode = WrapMode.Loop;
        //animation["zombiewalk"].layer = 2; animation["zombiewalk"].wrapMode = WrapMode.Loop;

        animation.Play("idle_2");
    }
    void Start()
    {
        // validate component references
        if (computer == null) computer = GetComponent(typeof(RootMotionComputer)) as RootMotionComputer;
        if (character == null) character = GetComponent(typeof(CharacterController)) as CharacterController;

        // tell the computer to just output values but not apply motion
        computer.applyMotion = false;
        // tell the computer that this script will manage its execution
        computer.isManagedExternally = true;
        // since we are using a character controller, we only want the z translation output
        computer.computationMode = RootMotionComputationMode.ZTranslation;
        // initialize the computer
        computer.Initialize();

        // set up properties for the animations
        animation["idle"].layer = 0; animation["idle"].wrapMode = WrapMode.Loop;
        animation["walk"].layer = 1; animation["walk"].wrapMode = WrapMode.Loop;
        animation["run"].layer = 1; animation["run"].wrapMode = WrapMode.Loop;
        animation["fly"].layer = 3; animation["fly"].wrapMode = WrapMode.Loop;
        animation["glide"].layer = 3; animation["glide"].wrapMode = WrapMode.Once;
        animation["takeoff"].layer = 3; animation["takeoff"].wrapMode = WrapMode.Once;
        animation["fireBreath"].layer = 3; animation["fireBreath"].wrapMode = WrapMode.Once;

        //animation.Play("idle");
        animation.Play("fly");
    }
    void Start()
    {
        // validate component references
        if (computer == null) computer = GetComponent(typeof(RootMotionComputer)) as RootMotionComputer;
        if (character == null) character = GetComponent(typeof(CharacterController)) as CharacterController;

        // tell the computer to just output values but not apply motion
        computer.applyMotion = false;
        // tell the computer that this script will manage its execution
        computer.isManagedExternally = true;
        // since we are using a character controller, we only want the z translation output
        computer.computationMode = RootMotionComputationMode.ZTranslation;
        // initialize the computer
        computer.Initialize();

        // set up properties for the animations
        GetComponent<Animation>()["idle"].layer = 0; GetComponent<Animation>()["idle"].wrapMode = WrapMode.Loop;
        GetComponent<Animation>()["walk01"].layer = 1; GetComponent<Animation>()["walk01"].wrapMode = WrapMode.Loop;
        GetComponent<Animation>()["run"].layer = 1; GetComponent<Animation>()["run"].wrapMode = WrapMode.Loop;
        GetComponent<Animation>()["attack"].layer = 3; GetComponent<Animation>()["attack"].wrapMode = WrapMode.Once;
        GetComponent<Animation>()["headbutt"].layer = 3; GetComponent<Animation>()["headbutt"].wrapMode = WrapMode.Once;
        GetComponent<Animation>()["scratchidle"].layer = 3; GetComponent<Animation>()["scratchidle"].wrapMode = WrapMode.Once;
        GetComponent<Animation>()["walk02"].layer = 3; GetComponent<Animation>()["walk02"].wrapMode = WrapMode.Once;
        GetComponent<Animation>()["standup"].layer = 3; GetComponent<Animation>()["standup"].wrapMode = WrapMode.Once;

        GetComponent<Animation>().Play("idle");
    }
Пример #6
0
    void Start()
    {
        eye          = transform.Find("Hips/Spine/Spine1/Spine2/Neck/Neck1/Head/RightEye");
        followScript = GetComponent(typeof(AIFollow)) as AIFollow;

        // validate component references
        if (computer == null)
        {
            computer = GetComponent(typeof(RootMotionComputer)) as RootMotionComputer;
        }
        if (character == null)
        {
            character = GetComponent(typeof(CharacterController)) as CharacterController;
        }
        if (victim == null)
        {
            victim = GameObject.Find("Main Camera");
        }
        if (followScript.target == null)
        {
            followScript.target = GameObject.Find("Main Camera").transform;
        }

        lastInterval = Time.realtimeSinceStartup;

        // tell the computer to just output values but not apply motion
        computer.applyMotion = false;
        // tell the computer that this script will manage its execution
        computer.isManagedExternally = true;
        // since we are using a character controller, we only want the z translation output
        computer.computationMode = RootMotionComputationMode.ZTranslation;
        // initialize the computer
        computer.Initialize();

        // set up properties for the animations
        animation["idle"].layer        = 0; animation["idle"].wrapMode = WrapMode.Loop;
        animation["walk01"].layer      = 1; animation["walk01"].wrapMode = WrapMode.Loop;
        animation["run"].layer         = 1; animation["run"].wrapMode = WrapMode.Loop;
        animation["attack"].layer      = 3; animation["attack"].wrapMode = WrapMode.Once;
        animation["headbutt"].layer    = 3; animation["headbutt"].wrapMode = WrapMode.Once;
        animation["scratchidle"].layer = 3; animation["scratchidle"].wrapMode = WrapMode.Once;
        animation["walk02"].layer      = 3; animation["walk02"].wrapMode = WrapMode.Once;
        animation["standup"].layer     = 3; animation["standup"].wrapMode = WrapMode.Once;

        // Load audio
        //audio.clip = Resources.Load("zombie_moan1.mp3") as AudioClip;
        //audio.Play();
        variableInterval = updateInterval;

        //animation.Play("idle");
        Walk();
    }
Пример #7
0
    void Start()
    {
        // validate component references
        if (computer == null)
        {
            computer = GetComponent(typeof(RootMotionComputer)) as RootMotionComputer;
        }

        // tell the computer that this script will manage its execution
        computer.isManagedExternally = true;
        // initialize the computer
        computer.Initialize();

        // set up properties for the animations
        animation["trot"].layer = 1; animation["trot"].wrapMode = WrapMode.Once;
    }
    void OnSceneGUI()
    {
        computer = (RootMotionComputer) target;

        if (!computer.isDebugMode || computer.pelvis == null) return;

        Color col = Handles.color;

        // draw a label at the pelvis
        Handles.Label(computer.pelvis.position, "Pelvis");

        // draw the pelvis right axis
        Handles.color = rightAxisColor;
        Handles.ArrowCap(-1, computer.pelvis.position, computer.pelvis.rotation*Quaternion.FromToRotation(Vector3.forward, computer.pelvisRightAxis), computer.debugGizmoSize);
        Handles.Label(computer.pelvis.position+computer.pelvis.TransformDirection(computer.pelvisRightAxis).normalized*computer.debugGizmoSize, "Right Axis");

        Handles.color = col;
    }
Пример #9
0
    void Start()
    {
        //GameObject hahmo = GameObject.Find("asterix");
        //GameObject GC = GameObject.Find("GameController");
        //GameControllerSpawn GCS =  GC.GetComponent<GameControllerSpawn>();
        //transform.position = new Vector3(GCS.xSpawn, GCS.ySpawn, GCS.zSpawn);
        /*
            GameObject GC = GameObject.Find("GameController");
            GameControllerSpawn GCS = GC.GetComponent<GameControllerSpawn>();
            xSpawnChar = GCS.xSpawn;
            ySpawnChar = GCS.ySpawn;
            zSpawnChar = GCS.zSpawn;
        */
            //Debug.Log("KATO MYÖS TÄMÄ: "+GCS.xSpawn+", "+GCS.ySpawn+", "+GCS.zSpawn);

        //transform.position = new Vector3(xSpawnChar, ySpawnChar, zSpawnChar);
        //Debug.Log("Xx:"+GCS.xSpawn+" Yy:"+GCS.ySpawn+" Zz:"+GCS.zSpawn);

        //transform.position = new Vector3(0,0,0);

        // validate component references
        if (computer == null) computer = GetComponent(typeof(RootMotionComputer)) as RootMotionComputer;
        if (character == null) character = GetComponent(typeof(CharacterController)) as CharacterController;

        // tell the computer to just output values but not apply motion
        computer.applyMotion = true;
        // tell the computer that this script will manage its execution
        computer.isManagedExternally = true;
        // since we are using a character controller, we only want the z translation output
        computer.computationMode = RootMotionComputationMode.ZTranslation;
        // initialize the computer
        computer.Initialize();

        // set up properties for the animations
        animation["idle"].layer = 0; animation["idle"].wrapMode = WrapMode.Loop;
        animation["walk"].layer = 1; animation["walk"].wrapMode = WrapMode.Loop;
        //animation["run"].layer = 1; animation["run"].wrapMode = WrapMode.Loop;
        animation["jump"].layer = 4; animation["jump"].wrapMode = WrapMode.Once;
        animation["back_flip_to_uppercut"].layer = 2; animation["back_flip_to_uppercut"].wrapMode = WrapMode.Once;
        animation["running_jump"].layer = 3; animation["running_jump"].wrapMode = WrapMode.Once;
        //animation["zombiewalk"].layer = 2; animation["zombiewalk"].wrapMode = WrapMode.Loop;

        animation.Play("idle");
    }
	void Start()
	{
		eye = transform.Find("Hips/Spine/Spine1/Spine2/Neck/Neck1/Head/RightEye");
		followScript = GetComponent(typeof(AIFollow)) as AIFollow;
		
		// validate component references
		if (computer == null) computer = GetComponent(typeof(RootMotionComputer)) as RootMotionComputer;
		if (character == null) character = GetComponent(typeof(CharacterController)) as CharacterController;
		if (victim == null) victim = GameObject.Find("Main Camera");
		if (followScript.target == null) followScript.target = GameObject.Find("Main Camera").transform;
		
		lastInterval = Time.realtimeSinceStartup;
		
		// tell the computer to just output values but not apply motion
		computer.applyMotion = false;
		// tell the computer that this script will manage its execution
		computer.isManagedExternally = true;
		// since we are using a character controller, we only want the z translation output
		computer.computationMode = RootMotionComputationMode.ZTranslation;
		// initialize the computer
		computer.Initialize();
		
		// set up properties for the animations
		animation["idle"].layer = 0; animation["idle"].wrapMode = WrapMode.Loop;
		animation["walk01"].layer = 1; animation["walk01"].wrapMode = WrapMode.Loop;
		animation["run"].layer = 1; animation["run"].wrapMode = WrapMode.Loop;
		animation["attack"].layer = 3; animation["attack"].wrapMode = WrapMode.Once;
		animation["headbutt"].layer = 3; animation["headbutt"].wrapMode = WrapMode.Once;
		animation["scratchidle"].layer = 3; animation["scratchidle"].wrapMode = WrapMode.Once;
		animation["walk02"].layer = 3; animation["walk02"].wrapMode = WrapMode.Once;
		animation["standup"].layer = 3; animation["standup"].wrapMode = WrapMode.Once;
		
		// Load audio
		//audio.clip = Resources.Load("zombie_moan1.mp3") as AudioClip;
		//audio.Play();
		variableInterval = updateInterval;
		
		//animation.Play("idle");
		Walk();
		
	}
Пример #11
0
        protected virtual void Awake()
        {
            if (m_Config == null)
            {
                throw new ComponentNotFoundException("AnimConfig not defined!");
            }
            if (animation == null)
            {
                throw new ComponentNotFoundException("Animation not defined!");
            }
            m_RootMotionComp = GetComponent <RootMotionComputer>();
            m_Animation      = animation;
            m_Animation.playAutomatically = false;
            m_Animation.cullingType       = AnimationCullingType.AlwaysAnimate;
            AnimationState state = GetState(EAnimType.DIE);

            if (state != null && state.wrapMode != WrapMode.ClampForever)
            {
                Debug.LogError("Death animation wrapMode of '" + name + "' is not ClampForever!");
            }
        }
    void OnSceneGUI()
    {
        computer = (RootMotionComputer)target;

        if (!computer.isDebugMode || computer.pelvis == null)
        {
            return;
        }

        Color col = Handles.color;

        // draw a label at the pelvis
        Handles.Label(computer.pelvis.position, "Pelvis");

        // draw the pelvis right axis
        Handles.color = rightAxisColor;
        Handles.ArrowCap(-1, computer.pelvis.position, computer.pelvis.rotation * Quaternion.FromToRotation(Vector3.forward, computer.pelvisRightAxis), computer.debugGizmoSize);
        Handles.Label(computer.pelvis.position + computer.pelvis.TransformDirection(computer.pelvisRightAxis).normalized *computer.debugGizmoSize, "Right Axis");

        Handles.color = col;
    }