Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
292 changes: 292 additions & 0 deletions ferrous-game/Assets/AnimationModelControl.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,292 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class AnimationModelControl : MonoBehaviour
{
// Start is called before the first frame update
private GameObject idle_animation;
GameObject forward_animation;
GameObject backward_animation;
GameObject left_animation;
GameObject right_animation;
GameObject idle_handraise_animation;
GameObject forward_handraise_animation;
GameObject backward_handraise_animation;
GameObject left_handraise_animation;
GameObject right_handraise_animation;
GameObject forward_jump_animation;
GameObject left_jump_animation ;
GameObject right_jump_animation ;
void Start()
{
idle_animation = gameObject.transform.GetChild(0).gameObject;
forward_animation = gameObject.transform.GetChild(1).gameObject;
backward_animation = gameObject.transform.GetChild(2).gameObject;
left_animation = gameObject.transform.GetChild(3).gameObject;
right_animation = gameObject.transform.GetChild(4).gameObject;
idle_handraise_animation = gameObject.transform.GetChild(5).gameObject;
forward_handraise_animation = gameObject.transform.GetChild(6).gameObject;
backward_handraise_animation = gameObject.transform.GetChild(7).gameObject;
left_handraise_animation = gameObject.transform.GetChild(8).gameObject;
right_handraise_animation = gameObject.transform.GetChild(9).gameObject;
forward_jump_animation = gameObject.transform.GetChild(10).gameObject;
left_jump_animation = gameObject.transform.GetChild(11).gameObject;
right_jump_animation = gameObject.transform.GetChild(12).gameObject;
idle_animation.SetActive(true);
forward_animation.SetActive(false);
backward_animation.SetActive(false);
left_animation.SetActive(false);
right_animation.SetActive(false);
idle_handraise_animation.SetActive(false);
forward_handraise_animation.SetActive(false);
backward_handraise_animation.SetActive(false);
left_handraise_animation.SetActive(false);
right_handraise_animation.SetActive(false);
forward_jump_animation.SetActive(false);
left_jump_animation.SetActive(false);
right_jump_animation.SetActive(false);
}

// Update is called once per frame
void Update()
{
//right jump
if (Input.GetAxis("Horizontal") > 0.1 && Input.GetButton("Jump"))
{
idle_animation.SetActive(false);
forward_animation.SetActive(false);
backward_animation.SetActive(false);
left_animation.SetActive(false);
right_animation.SetActive(false);
idle_handraise_animation.SetActive(false);
forward_handraise_animation.SetActive(false);
backward_handraise_animation.SetActive(false);
left_handraise_animation.SetActive(false);
right_handraise_animation.SetActive(false);
forward_jump_animation.SetActive(false);
left_jump_animation.SetActive(false);
right_jump_animation.SetActive(true);
}
//left jump
else if (Input.GetAxis("Horizontal") < -0.01 && Input.GetButton("Jump"))
{
idle_animation.SetActive(false);
forward_animation.SetActive(false);
backward_animation.SetActive(false);
left_animation.SetActive(false);
right_animation.SetActive(false);
idle_handraise_animation.SetActive(false);
forward_handraise_animation.SetActive(false);
backward_handraise_animation.SetActive(false);
left_handraise_animation.SetActive(false);
right_handraise_animation.SetActive(false);
forward_jump_animation.SetActive(false);
left_jump_animation.SetActive(true);
right_jump_animation.SetActive(false);
}
//forward jump
else if (Input.GetAxis("Vertical") > 0.1 && Input.GetButton("Jump"))
{
idle_animation.SetActive(false);
forward_animation.SetActive(false);
backward_animation.SetActive(false);
left_animation.SetActive(false);
right_animation.SetActive(false);
idle_handraise_animation.SetActive(false);
forward_handraise_animation.SetActive(false);
backward_handraise_animation.SetActive(false);
left_handraise_animation.SetActive(false);
right_handraise_animation.SetActive(false);
forward_jump_animation.SetActive(true);
left_jump_animation.SetActive(false);
right_jump_animation.SetActive(false);
}
//backward jump (JUST A FORWARD Jump)
else if (Input.GetAxis("Vertical") < -0.01 && Input.GetButton("Jump"))
{
idle_animation.SetActive(false);
forward_animation.SetActive(false);
backward_animation.SetActive(false);
left_animation.SetActive(false);
right_animation.SetActive(false);
idle_handraise_animation.SetActive(false);
forward_handraise_animation.SetActive(false);
backward_handraise_animation.SetActive(false);
left_handraise_animation.SetActive(false);
right_handraise_animation.SetActive(false);
forward_jump_animation.SetActive(true);
left_jump_animation.SetActive(false);
right_jump_animation.SetActive(false);
}

//right hand raise
else if (Input.GetAxis("Horizontal") > 0.1 && (Input.GetButton("Fire1") || Input.GetAxisRaw("Fire1") > 0 || Input.GetButton("Fire2") || Input.GetAxisRaw("Fire2") > 0))
{
idle_animation.SetActive(false);
forward_animation.SetActive(false);
backward_animation.SetActive(false);
left_animation.SetActive(false);
right_animation.SetActive(false);
idle_handraise_animation.SetActive(false);
forward_handraise_animation.SetActive(false);
backward_handraise_animation.SetActive(false);
left_handraise_animation.SetActive(false);
right_handraise_animation.SetActive(true);
forward_jump_animation.SetActive(false);
left_jump_animation.SetActive(false);
right_jump_animation.SetActive(false);
}
//left hand raise
else if (Input.GetAxis("Horizontal") < -0.01 && (Input.GetButton("Fire1") || Input.GetAxisRaw("Fire1") > 0 || Input.GetButton("Fire2") || Input.GetAxisRaw("Fire2") > 0))
{
idle_animation.SetActive(false);
forward_animation.SetActive(false);
backward_animation.SetActive(false);
left_animation.SetActive(false);
right_animation.SetActive(false);
idle_handraise_animation.SetActive(false);
forward_handraise_animation.SetActive(false);
backward_handraise_animation.SetActive(false);
left_handraise_animation.SetActive(true);
right_handraise_animation.SetActive(false);
forward_jump_animation.SetActive(false);
left_jump_animation.SetActive(false);
right_jump_animation.SetActive(false);
}
//forward hand raise
else if (Input.GetAxis("Vertical") > 0.1 && (Input.GetButton("Fire1") || Input.GetAxisRaw("Fire1") > 0 || Input.GetButton("Fire2") || Input.GetAxisRaw("Fire2") > 0))
{
idle_animation.SetActive(false);
forward_animation.SetActive(false);
backward_animation.SetActive(false);
left_animation.SetActive(false);
right_animation.SetActive(false);
idle_handraise_animation.SetActive(false);
forward_handraise_animation.SetActive(true);
backward_handraise_animation.SetActive(false);
left_handraise_animation.SetActive(false);
right_handraise_animation.SetActive(false);
forward_jump_animation.SetActive(false);
left_jump_animation.SetActive(false);
right_jump_animation.SetActive(false);
}
//backward hand raise
else if (Input.GetAxis("Vertical") < -0.01 && (Input.GetButton("Fire1") || Input.GetAxisRaw("Fire1") > 0 || Input.GetButton("Fire2") || Input.GetAxisRaw("Fire2") > 0))
{
idle_animation.SetActive(false);
forward_animation.SetActive(false);
backward_animation.SetActive(false);
left_animation.SetActive(false);
right_animation.SetActive(false);
idle_handraise_animation.SetActive(false);
forward_handraise_animation.SetActive(false);
backward_handraise_animation.SetActive(true);
left_handraise_animation.SetActive(false);
right_handraise_animation.SetActive(false);
forward_jump_animation.SetActive(false);
left_jump_animation.SetActive(false);
right_jump_animation.SetActive(false);
}
//idle hand raise
else if (Input.GetButton("Fire1") || Input.GetAxisRaw("Fire1") > 0 || Input.GetButton("Fire2") || Input.GetAxisRaw("Fire2") > 0) {
idle_animation.SetActive(false);
forward_animation.SetActive(false);
backward_animation.SetActive(false);
left_animation.SetActive(false);
right_animation.SetActive(false);
idle_handraise_animation.SetActive(true);
forward_handraise_animation.SetActive(false);
backward_handraise_animation.SetActive(false);
left_handraise_animation.SetActive(false);
right_handraise_animation.SetActive(false);
forward_jump_animation.SetActive(false);
left_jump_animation.SetActive(false);
right_jump_animation.SetActive(false);
}
//right walk
else if (Input.GetAxis("Horizontal") > 0.1)
{
idle_animation.SetActive(false);
forward_animation.SetActive(false);
backward_animation.SetActive(false);
left_animation.SetActive(false);
right_animation.SetActive(true);
idle_handraise_animation.SetActive(false);
forward_handraise_animation.SetActive(false);
backward_handraise_animation.SetActive(false);
left_handraise_animation.SetActive(false);
right_handraise_animation.SetActive(false);
forward_jump_animation.SetActive(false);
left_jump_animation.SetActive(false);
right_jump_animation.SetActive(false);
}
//left walk
else if (Input.GetAxis("Horizontal") < -0.01)
{
idle_animation.SetActive(false);
forward_animation.SetActive(false);
backward_animation.SetActive(false);
left_animation.SetActive(true);
right_animation.SetActive(false);
idle_handraise_animation.SetActive(false);
forward_handraise_animation.SetActive(false);
backward_handraise_animation.SetActive(false);
left_handraise_animation.SetActive(false);
right_handraise_animation.SetActive(false);
forward_jump_animation.SetActive(false);
left_jump_animation.SetActive(false);
right_jump_animation.SetActive(false);
}
//forward walk
else if (Input.GetAxis("Vertical") > 0.1)
{
idle_animation.SetActive(false);
forward_animation.SetActive(true);
backward_animation.SetActive(false);
left_animation.SetActive(false);
right_animation.SetActive(false);
idle_handraise_animation.SetActive(false);
forward_handraise_animation.SetActive(false);
backward_handraise_animation.SetActive(false);
left_handraise_animation.SetActive(false);
right_handraise_animation.SetActive(false);
forward_jump_animation.SetActive(false);
left_jump_animation.SetActive(false);
right_jump_animation.SetActive(false);
}
//backward walk
else if (Input.GetAxis("Vertical") < -0.01)
{
idle_animation.SetActive(false);
forward_animation.SetActive(false);
backward_animation.SetActive(true);
left_animation.SetActive(false);
right_animation.SetActive(false);
idle_handraise_animation.SetActive(false);
forward_handraise_animation.SetActive(false);
backward_handraise_animation.SetActive(false);
left_handraise_animation.SetActive(false);
right_handraise_animation.SetActive(false);
forward_jump_animation.SetActive(false);
left_jump_animation.SetActive(false);
right_jump_animation.SetActive(false);
}
//idle
else {
idle_animation.SetActive(true);
forward_animation.SetActive(false);
backward_animation.SetActive(false);
left_animation.SetActive(false);
right_animation.SetActive(false);
idle_handraise_animation.SetActive(false);
forward_handraise_animation.SetActive(false);
backward_handraise_animation.SetActive(false);
left_handraise_animation.SetActive(false);
right_handraise_animation.SetActive(false);
forward_jump_animation.SetActive(false);
left_jump_animation.SetActive(false);
right_jump_animation.SetActive(false);
}
}
}
11 changes: 11 additions & 0 deletions ferrous-game/Assets/AnimationModelControl.cs.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions ferrous-game/Assets/Animations.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions ferrous-game/Assets/Animations/Handraise.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!1102 &-1061013766006315703
AnimatorState:
serializedVersion: 6
m_ObjectHideFlags: 1
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name: Backwards
m_Speed: 1
m_CycleOffset: 0
m_Transitions: []
m_StateMachineBehaviours: []
m_Position: {x: 50, y: 50, z: 0}
m_IKOnFeet: 0
m_WriteDefaultValues: 1
m_Mirror: 0
m_SpeedParameterActive: 0
m_MirrorParameterActive: 0
m_CycleOffsetParameterActive: 0
m_TimeParameterActive: 0
m_Motion: {fileID: 1827226128182048838, guid: 988dab660a08b4e40a575100e4dccc21, type: 3}
m_Tag:
m_SpeedParameter:
m_MirrorParameter:
m_CycleOffsetParameter:
m_TimeParameter:
--- !u!91 &9100000
AnimatorController:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name: Backward_handraise
serializedVersion: 5
m_AnimatorParameters: []
m_AnimatorLayers:
- serializedVersion: 5
m_Name: Base Layer
m_StateMachine: {fileID: 7510747858676064905}
m_Mask: {fileID: 0}
m_Motions: []
m_Behaviours: []
m_BlendingMode: 0
m_SyncedLayerIndex: -1
m_DefaultWeight: 0
m_IKPass: 0
m_SyncedLayerAffectsTiming: 0
m_Controller: {fileID: 9100000}
--- !u!1107 &7510747858676064905
AnimatorStateMachine:
serializedVersion: 6
m_ObjectHideFlags: 1
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name: Base Layer
m_ChildStates:
- serializedVersion: 1
m_State: {fileID: -1061013766006315703}
m_Position: {x: 158.2279, y: 230.28467, z: 0}
m_ChildStateMachines: []
m_AnyStateTransitions: []
m_EntryTransitions: []
m_StateMachineTransitions: {}
m_StateMachineBehaviours: []
m_AnyStatePosition: {x: 50, y: 20, z: 0}
m_EntryPosition: {x: 50, y: 120, z: 0}
m_ExitPosition: {x: 800, y: 120, z: 0}
m_ParentStateMachinePosition: {x: 800, y: 20, z: 0}
m_DefaultState: {fileID: -1061013766006315703}
Loading