// Use this for initialization void Start() { if (Camera.main != null) { cam = Camera.main.transform; } rigidBody = GetComponent <Rigidbody> (); animator = GetComponent <Animator>(); locomotion = new Locomotion(animator); isoCam = Camera.main.GetComponent <IsometricCamera>(); capsule = GetComponent <CapsuleCollider>(); capsuleHeight = capsule.height; capsuleCenter = capsule.center; //define avatarBones with rigid bodies in player game object avatarBones = gameObject.GetComponentsInChildren <Rigidbody>(); //set avatarBones to is kinematic foreach (Rigidbody bone in avatarBones) { bone.isKinematic = true; } rigidBody.isKinematic = false; rigidBody.constraints = RigidbodyConstraints.FreezeRotationX | RigidbodyConstraints.FreezeRotationY | RigidbodyConstraints.FreezeRotationZ; origGroundCheckDistance = groundCheckDistance; }
// Start is called before the first frame update void Start() { playerRef = GameObject.FindGameObjectWithTag("Player"); playerLocomotion = playerRef.GetComponent <Locomotion>(); playerController = playerRef.GetComponent <PlayerController>(); cooldown = playerLocomotion.crouchCooldown; }
// Use this for initialization void Awake() { leader = GameObject.FindGameObjectWithTag(Tags.Leader).transform; animator = GetComponent <Animator>(); locomotion = new Locomotion(animator); vehicle = GetComponent <Vehicle>(); }
void Start() { agent.updateRotation = false; locomotion = new Locomotion(animator); direction = transform.forward; }
void Awake() { animator = GetComponent <Animator>(); rigid = GetComponent <Rigidbody>(); locomotion = new Locomotion(animator); }
private void Update() { if (GameManager.Instance.IsGameOver) { return; } if (!IsInputBlocked) { Input.UpdateBehaviour(); } if (LocomotionActive) { Locomotion.UpdateBehaviour(); } Animation.UpdateBehaviour(); m_AutographCooldown -= GameManager.Instance.DeltaTime; UIManager.Instance.UpdateUICoolDown(GetAutographNorm()); if (Input.ShootAutograph && m_AutographCooldown < 0f) { ShootAutograph(); } }
public override void OnEnter() { // get the animator component var go = Fsm.GetOwnerDefaultTarget(gameObject); if (go == null) { Finish(); return; } _animator = go.GetComponent <Animator>(); if (_animator == null) { Finish(); return; } _locomotion = new Locomotion(_animator); SetLocomotion(); if (!everyFrame) { Finish(); } }
private bool GetPositionToDrible(PlayerController enemy, out Vector3 toGo) { bool result = false; Vector3 resultPosition = Vector3.zero; Vector3 freePos = Vector3.zero; if (GetFreeHit(out freePos, enemy.transform.position, true)) { resultPosition = freePos; result = true; } else { Vector3 pos = Locomotion.GetRandomNavCircle(Player.transform.position, 3.5f); resultPosition = pos; if (Player.IsHitBetween(pos) == false) { result = true; } } toGo = resultPosition; return(result); }
protected virtual void OnMove(Vector2 input, bool running) { var cam = CameraManager.Mode as IRotatableCamera; if (input.magnitude > 0 && cam is IPerspectiveCamera) { var speed = Locomotion.RotateTowards(Vector3.up, cam.Heading); cam.Heading -= speed * Time.deltaTime; } var movement = input.normalized; Locomotion.Move(new Vector3(movement.x, 0, movement.y)); if (running && Locomotion.Pacing != RunningPace) { Locomotion.Pacing = RunningPace; } if (!running && Locomotion.Pacing == RunningPace) { Locomotion.Pacing = WalkingPace; } }
public override void OnEnter() { // get the animator component var go = Fsm.GetOwnerDefaultTarget(gameObject); if (go==null) { Finish(); return; } _animator = go.GetComponent<Animator>(); if (_animator==null) { Finish(); return; } _locomotion = new Locomotion(_animator); SetLocomotion(); if (!everyFrame) { Finish(); } }
private void Start() { startingPosition = transform.localPosition; myRenderer = GetComponent <Renderer>(); locomotion = FindObjectOfType <Locomotion>(); SetGazedAt(false); }
public void Update() { Time.Update(); DoInput(); Locomotion.Update(); InteractionDetection.Update(); }
public void Start() { battleDecisionMaker = new BattleDecisionMaker(this); locomotion = new Locomotion(transform); slider = GetComponentInChildren <Slider>(); slider.GetComponentInParent <Canvas>().worldCamera = Camera.main; }
public void Reset() { Score.Reset(); Time.Reset(); Hand.Reset(); Locomotion.Reset(); Time.Start(); }
// Use this for initialization void Start() { controller = GetComponent <CharacterController> (); floorMask = LayerMask.GetMask("Defalut"); animator = GetComponent <Animator>(); locomotion = new Locomotion(animator); gameObject.transform.position = _spawn.position; }
// Use this for initialization void Start() { agent = GetComponent <UnityEngine.AI.NavMeshAgent>(); agent.updateRotation = false; animator = GetComponent <Animator>(); locomotion = new Locomotion(animator); }
// Use this for initialization void Start() { agent = GetComponent<NavMeshAgent>(); agent.updateRotation = false; animator = GetComponent<Animator>(); locomotion = new Locomotion(animator); player = GameObject.FindGameObjectWithTag("Player"); }
/// <summary> /// this is the event handler of loading the form and we have intialised it by clearing the /// form. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void BMI_Calculator_Form_Load(object sender, EventArgs e) { Clear_Numeric_Keyboard(); Active_Label = null; BMICalculatorTableLayoutPanel.Visible = false; Size = new Size(320, 480); animated_field = Locomotion.IDLE; }
void Start() { targetPosition = transform.position; agent = GetComponent <NavMeshAgent>(); agent.updateRotation = false; animator = GetComponent <Animator>(); locomotion = new Locomotion(animator); searchTimeCurrent = 0; }
public void Reset() { Input.Initialize(this); Locomotion.Initialize(this); Animation.Initialize(this); m_AutographCooldown = 0f; UIManager.Instance.UpdateUICoolDown(GetAutographNorm()); }
protected void Move(Vector3 position) { Agent.SetDestination(position); //Move para o destino Vector2 move = Locomotion.GetDirectionAI(); Speed = move.y; Direction = move.x; }
void Start () { targetPosition = transform.position; agent = GetComponent<NavMeshAgent>(); agent.updateRotation = false; animator = GetComponent<Animator>(); locomotion = new Locomotion(animator); searchTimeCurrent = 0; }
public InputHandler(Character c, Locomotion l, int n) { character = c; locomotion = l; locomotion.Init(); controller = new JoystickConfig(n); SwitchStates(0); }
// Use this for initialization void Start () { agent = GetComponent<NavMeshAgent>(); agent.updateRotation = false; animator = GetComponent<Animator>(); locomotion = new Locomotion(animator); particleClone = null; }
protected void Lookat(Vector3 position) { //Move para o destino Agent.SetDestination(Player.transform.position); Vector2 move = Locomotion.GetDirection(position); Speed = 0; Direction = move.x; }
// Use this for initialization void Start() { body = GetComponent <Rigidbody>(); animator = GetComponent <Animator>(); locomotion = new Locomotion(animator); TSTrafficAI ai = GetComponent <TSTrafficAI>(); ai.OnUpdateAI = OnAIUpdate; ai.UpdateCarSpeed = UpdateSpeed; }
public void GetPath_WrappingSpace_ShortestPath( int startColumn, int startRow, int goalColumn, int goalRow, Locomotion locomotion ) { IMap map = new Map(10, 10, DefaultInitializer); ref MapCell start = ref map.GetCell(startColumn, startRow);
// Use this for initialization void Start() { body = GetComponent<Rigidbody>(); animator = GetComponent<Animator>(); locomotion = new Locomotion(animator); TSTrafficAI ai = GetComponent<TSTrafficAI>(); ai.OnUpdateAI = OnAIUpdate; ai.UpdateCarSpeed = UpdateSpeed; }
private record PathRequest( IMap Map, int StartColumn, int StartRow, int GoalColumn, int GoalRow, Locomotion Locomotion, IPathfindingCallback Callback, int CallbackContext );
// Use this for initialization void Start() { agent = GetComponent <NavMeshAgent>(); agent.updateRotation = false; animator = GetComponent <Animator>(); locomotion = new Locomotion(animator); particleClone = null; }
private void BMI_Calculator_Form_Click(object sender, EventArgs e) { Clear_Numeric_Keyboard(); if (Active_Label != null) { Active_Label.BackColor = Color.White; } Active_Label = null; animated_field = Locomotion.DOWN; Timer_for_Animation.Enabled = true; }
void Start() { animator = GetComponent <Animator>(); locomotion = new Locomotion(animator); rb = GetComponent <Rigidbody>(); canShoot = true; canCastAbility1 = true; canCastAbility2 = true; canCastAbility3 = true; }
void Start() { _stateNameHash = Animator.StringToHash("Estado"); _animator = GetComponentInChildren <Animator>(); _currentState = 0; _horizontal = transform.eulerAngles.y; _vertical = transform.eulerAngles.x; _locomotion = new Locomotion(_animator); Cursor.lockState = CursorLockMode.Locked; Cursor.visible = false; }
void Update() { if(m_Locomotion == null) m_Locomotion = new Locomotion(m_Animator); if (m_Animator && Camera.main) { JoystickToWorld.ComputeSpeedDirection(transform,ref m_Speed, ref m_Direction); } m_Locomotion.Do(m_Speed * 6, m_Direction * 180); m_Animator.SetBool("HoldLog", hasLog); }
public void Awake() { animator = GetComponentInChildren <Animator>(); locomotion = GetComponent <Locomotion>(); locomotionWasEnabled = locomotion.isActiveAndEnabled; ecoTarget = GetComponent <EcoTarget>(); animatorLink = GetComponentInChildren <AnimatorLink>(); rb = GetComponent <Rigidbody>(); modelRoot = GetComponentInChildren <Renderer>().gameObject; iceMaterial = Player.main.GetComponent <PlayerFrozenMixin>().GetPrivateField("iceMaterial") as Material; }
void Start() { agent = GetComponent<NavMeshAgent>(); agent.updateRotation = false; animator = GetComponent<Animator>(); locomotion = new Locomotion(animator); targetClone = Instantiate(target,transform.position,transform.rotation) as GameObject; targetClone.transform.parent = transform.parent; // Dont move if timer set to 0 or negative if (targetMoveTimer > 0.0f) StartCoroutine (MoveTarget()); }
public override bool Init(Agent agent, Locomotion locomotion, Animator animator) { mAnimStates.Add((int)StateType.Idle, new AnimStateIdle(agent, locomotion, animator)); mAnimStates.Add((int)StateType.Die, new AnimStateDie(agent, locomotion, animator)); mAnimStates.Add((int)StateType.Walk, new AnimStateGoTo(agent, locomotion, animator)); // run?? mAnimStates.Add((int)StateType.Jump, new AnimStateJumpTo(agent, locomotion, animator)); mAnimStates.Add((int)StateType.Attack, new AnimStateAttack(agent, locomotion, animator)); mDefaultState = mAnimStates[(int)StateType.Idle]; base.Init(agent, locomotion, animator); return true; }
public Actor( int column, int row, Locomotion locomotion ) { Column = column; Row = row; Locomotion = locomotion; _currentRouteIndex = -1; _currentActivity = -1; _currentStep = -1; Errand = Errand.Idle; }
void Start() { // Use this for initialization avatar = GetComponent <Animator> (); controller = GetComponent <CharacterController> (); avatar.speed = 1f; // + UnityEngine.Random.Range (-0.4f, 0.4f); navAgent = GetComponent <UnityEngine.AI.NavMeshAgent>(); navAgent.updateRotation = false; locomotion = new Locomotion(avatar); }
public Locomotion(int index, Locomotion parent) : base() { Index = index; if (parent != null) { Color = LocoStep.Mutate(parent.Color); } else { Color = new Color(UnityEngine.Random.Range(0f, 1f), UnityEngine.Random.Range(0f, 1f), UnityEngine.Random.Range(0f, 1f)); } const int MonsPerRow = 10; var pos = new Vector3((index % MonsPerRow) * 3f, -1.38f, Mathf.Floor(index / MonsPerRow) * 6f); var physicsLayer = 8 + (index % 20); _monster = new Monster(physicsLayer, Color); _monster.Transform.position = pos; if (parent != null) { Steps = LocoStep.Mutate(parent.Steps); } else { Steps = new List<LocoStep>(); foreach (var joint in _monster.Joints.Keys) { var temp = joint; Steps.Add(LocoStep.SpawnNew(temp)); Steps.Add(LocoStep.SpawnNew(temp)); } } for (var i = 0; i < Steps.Count; ++i) Steps[i].NextAt = Steps[i].At; _monster.UnityFixedUpdate += OnFixedUpdate; }
public void Save(Locomotion loco) { var name = Guid.NewGuid().ToString(); _indexWriter.WriteLine(loco.FinalScore + "," + name); _indexWriter.Flush(); //Write complex data var lines = new List<string>(); { var cells = new string[] { "Joint", "At", "Duration", "Force", "Rotation.x", "Rotation.y", "Rotation.z", }; lines.Add(string.Join(",", cells)); } foreach(var step in loco.Steps) { var cells = new string[] { step.Joint, step.At.ToString(), step.Duration.ToString(), step.Force.ToString(), step.Rotation.x.ToString(), step.Rotation.y.ToString(), step.Rotation.z.ToString(), }; lines.Add(string.Join(",", cells)); } File.WriteAllLines(_dir + "/" + name + ".csv", lines.ToArray()); }
public AnimState(Agent agent, Locomotion locomotion, Animator animator) { mAgent = agent; mLocomotion = locomotion; mAnimator = animator; }
// Use this for initialization void Start() { if (time < 0.1f) time = 0.1f; if (time > 5.0f) time = 5.0f; agent = GetComponent<NavMeshAgent>(); agent.updateRotation = false; animator = GetComponent<Animator>(); locomotion = new Locomotion(animator); targetClone = Instantiate(target,transform.position,transform.rotation) as GameObject; //MoveTarget(); }
public virtual bool Init(Agent agent, Locomotion locomotion, Animator animator) { return true; }
IEnumerator DoPreform() { var logs = new LocoLogs(); _monsPerRound = 40; _monsToKeep = 6; _childrenToMutate = 6; _bestInject = 1; Application.RegisterLogCallback(OnLog); List<Locomotion> bestLocos = new List<Locomotion>(); while(true) { LoadConfigSettings(); Generation++; var locos = new List<Locomotion>(); var i = 0; for (var bestIndex = 0; bestIndex < bestLocos.Count; ++bestIndex ) { if (_bestInject > 0 && bestIndex >= _monsToKeep - _bestInject && _bestAllTime != null) { //Use best alltime for (var childIndex = 0; childIndex < _childrenToMutate; ++childIndex) { locos.Add(new Locomotion(_monsPerRound - i - 1, _bestAllTime)); i++; } continue; } for (var childIndex = 0; childIndex < _childrenToMutate; ++childIndex) { //Index modified so children appear at front locos.Add(new Locomotion(_monsPerRound - i - 1, bestLocos[bestIndex])); i++; } } for (; i < _monsPerRound; i++) { //Index modified so children appear at front locos.Add(new Locomotion(_monsPerRound - i - 1, null)); } while (locos.Any(l => !l.Finished)) yield return null; foreach (var loco in locos) logs.Save(loco); bestLocos = locos.OrderByDescending(loco => loco.FinalScore).Take(_monsToKeep).ToList(); var best = bestLocos.First(); if (_bestAllTime == null || best.FinalScore > _bestAllTime.FinalScore) _bestAllTime = best; if (bestLocos.First().FinalScore > TopScore) { TopScore = bestLocos.First().FinalScore; TopScoreGen = Generation; } foreach (var l in locos) l.Stop(); } }
// public Camera ngui_camera = null; // Use this for initialization void Start() { agent = GetComponent<NavMeshAgent>(); agent.updateRotation = false; animator = GetComponent<Animator>(); using(locomotion = new Locomotion(animator)){locomotion.Dispose();} particleClone = null; NGUILayerMask = LayerMask.NameToLayer("Default"); // print("NGUI layerDepth : " + NGUILayerMask); }
// Use this for initialization void Start() { old_forward = transform.forward; animator = GetComponent<Animator>(); locomotion = new Locomotion(animator); anim_speed_default = animator.speed; dist_to_ground = GetComponent<CapsuleCollider>().height; }
void Start() { audioSource = GetComponent<AudioSource> (); ribo = GetComponent<Rigidbody>(); locomotion = GetComponent<Locomotion>(); bodyAnimation = GetComponent<BodyAnimation>(); emotion = GetComponent <SushiEmotion> (); currentState = SushiState.ALIVE; Invoke ("GenerateCheeringSound", Random.Range(1,10)); MakeSound("spawning"); }
/*////////////////////////////////////*/ //Fonction de démarrage /*////////////////////////////////////*/ void Start() { animator = GetComponent<Animator>(); locomotion = new Locomotion(animator); }
void Start() { ribo = GetComponent<Rigidbody>(); locomotion = GetComponent<Locomotion>(); bodyAnimation = GetComponent<BodyAnimation>(); }
public AnimStateJumpTo(Agent agent, Locomotion locomotion, Animator animator) : base(agent, locomotion, animator) { }
// Use this for initialization void Awake() { agent = GetComponent<NavMeshAgent>(); agent.updateRotation = false; animator = GetComponent<Animator>(); locomotion = new Locomotion(animator); hash = GameObject.FindGameObjectWithTag(Tags.gameController).GetComponent<HashIds>(); particleClone = null; }
IEnumerator Schedule(Locomotion chunk) { DebugManager.Instance.OnChunkStart(chunk); yield return null; }
public AnimStateAttack(Agent agent, Locomotion locomotion, Animator animator) : base(agent, locomotion, animator) { }