public override void OnStateEnter(Animator animator, AnimatorStateInfo stateInfo, int layerIndex) { base.OnStateEnter(animator, stateInfo, layerIndex); if (stateInfo.IsName("Base.Waiting")) { // Initizalize references if (bridge == null) { anim = new SmartAnimator(animator); bridge = animator.GetComponent <MachineInterface>(); } OnEnterWaiting(); } if (stateInfo.IsName("Base.Working")) { OnEnterWorking(); } if (stateInfo.IsName("Base.Completed")) { OnEnterCompleted(); } if (stateInfo.IsName("Base.Overheating")) { OnEnterOverheat(); } if (stateInfo.IsName("Base.Overload")) { OnEnterOverload(); } }
protected virtual void Awake() { // Initialize stuff anim = new SmartAnimator(GetComponent <Animator> ()); effects = new Dictionary <string, Locks> (); // Initialize crystal mat = GetComponentInChildren <Renderer> ().sharedMaterial; _EmissionColor = Shader.PropertyToID("_EmissionColor"); SwitchCrystal(value: true); // Get some references me = GetComponent <CharacterController> (); areaOfEffect = GetComponentInChildren <Marker> (); areaCollider = areaOfEffect.GetComponent <SphereCollider> (); targetRotation = transform.rotation; // Find other playera FindOther(); // Spawn Audio prefab var prefab = Resources.Load <CharacterSFX> ("Prefabs/Audio/Character_SFX"); sound = Instantiate(prefab, transform); }
private void Start() { // Get references cam = Camera.main.transform; other = FindObjectsOfType <Selector> ().First(s => s != this); lightIntensity = light.intensity; icons = new Dictionary <Graphic, float> (); foreach (var g in canvas.GetComponentsInChildren <Graphic> ()) { icons.Add(g, g.color.a); } // Initialize animator anim = new SmartAnimator(canvas.GetComponent <Animator> ()); // Turn off by default SwitchState(state: false); // Update UI UpdateControllerInfo(); userName.onEndEdit.AddListener(str => EndedEdit(str)); // Turn off all crystals showcase.ToList().ForEach(c => c.SwitchCrystal(value: false)); }
private void Awake() { menu = this; anim = new SmartAnimator(GetComponent <Animator> ()); // Initialize graphics-alpha_values dictionary graphics = new Dictionary <Graphic, float> (); foreach (var g in GetComponentsInChildren <Graphic> (true)) { graphics.Add(g, g.color.a); } }