private void CreateNavSearchAgent() { if (!this.actor.isMovable) { return; } Seeker seeker = base.gameObject.GetComponent <Seeker>(); if (!seeker) { seeker = base.gameObject.AddComponent <Seeker>(); } FunnelModifier funnelModifier = base.gameObject.GetComponent <FunnelModifier>(); if (!funnelModifier) { funnelModifier = base.gameObject.AddComponent <FunnelModifier>(); } seeker.startEndModifier.Priority = 3; funnelModifier.Priority = 2; if (this.actor.TheActorMeta.ActorType == ActorTypeDef.Actor_Type_Monster || this.actor.TheActorMeta.ActorType == ActorTypeDef.Actor_Type_Hero) { RVOController rVOController = base.gameObject.GetComponent <RVOController>(); if (!rVOController) { rVOController = base.gameObject.AddComponent <RVOController>(); } rVOController.maxSpeed = this.maxSpeed; rVOController.enabled = true; rVOController.EnsureActorAndSimulator(); } }
private void CreateNavSearchAgent() { if (base.actor.isMovable) { Seeker component = base.gameObject.GetComponent <Seeker>(); if (component == null) { component = base.gameObject.AddComponent <Seeker>(); } FunnelModifier modifier = base.gameObject.GetComponent <FunnelModifier>(); if (modifier == null) { modifier = base.gameObject.AddComponent <FunnelModifier>(); } component.startEndModifier.Priority = 3; modifier.Priority = 2; if ((base.actor.TheActorMeta.ActorType == ActorTypeDef.Actor_Type_Monster) || (base.actor.TheActorMeta.ActorType == ActorTypeDef.Actor_Type_Hero)) { RVOController controller = base.gameObject.GetComponent <RVOController>(); if (controller == null) { controller = base.gameObject.AddComponent <RVOController>(); } controller.maxSpeed = this.maxSpeed; controller.enabled = true; controller.EnsureActorAndSimulator(); } } }
private void Awake() { aiPath = GetComponent <RichAI>(); characterAnim = GetComponent <CharacterAnimCpt>(); rvoController = GetComponent <RVOController>(); rvoController.priority = Random.Range(0f, 1f); }
public static bool OnSkillFuncIgnoreRVO(ref SSkillFuncContext inContext) { PoolObjHandle <ActorRoot> inTargetObj = inContext.inTargetObj; if (inTargetObj != 0) { RVOController component = null; if (inContext.inStage == ESkillFuncStage.Enter) { component = inTargetObj.handle.gameObject.GetComponent <RVOController>(); if (component != null) { component.enabled = false; } } else if (inContext.inStage == ESkillFuncStage.Leave) { component = inTargetObj.handle.gameObject.GetComponent <RVOController>(); if (component != null) { component.enabled = true; } } } return(true); }
void Awake() { seeker = GetComponent <Seeker>(); controller = GetComponent <CharacterController>(); rvoController = GetComponent <RVOController>(); tr = transform; }
protected override void Awake() { base.Awake(); transform = (this as MonoBehaviour).transform; ai = GetComponent <IAstarAI>(); rvo = GetComponent <RVOController>(); weapon = GetComponent <RTSWeapon>(); }
//private int _currentState; void Start() { _animator = GetComponent <Animator>(); _prevState = _animator.GetCurrentAnimatorStateInfo(0).nameHash; _rvo = GetComponent <RVOController>(); _prevPos = transform.position; }
public void Awake() { _networkLocomotionComponentViewRPC = FindReplicationViewForComponent <NetworkLocomotionComponent>(); _locomotion = GetComponent <LocomotionComponentAPP>(); _rvoController = GetComponent <RVOController>(); _isCurrentlyLocal = AmILocal(); _currentOwnerId = _networkLocomotionComponentViewRPC.ownerId; }
public override void OnUse() { base.OnUse(); this.targetId = 0; this.freezeHeight = 0; this.actorObj.Release(); this.curAnimName = null; this.rovController = null; }
/** Initializes reference variables. * If you override this function you should in most cases call base.Awake () at the start of it. */ protected override void Awake() { base.Awake(); seeker = GetComponent <Seeker>(); controller = GetComponent <CharacterController>(); rigid = GetComponent <Rigidbody>(); rigid2D = GetComponent <Rigidbody2D>(); rvoController = GetComponent <RVOController>(); tr = transform; }
protected virtual void FindComponents() { tr = transform; seeker = GetComponent <Seeker>(); rvoController = GetComponent <RVOController>(); // Find attached movement components controller = GetComponent <CharacterController>(); rigid = GetComponent <Rigidbody>(); rigid2D = GetComponent <Rigidbody2D>(); }
private void Awake() { this.seeker = base.GetComponent <Seeker>(); this.controller = base.GetComponent <CharacterController>(); this.rvoController = base.GetComponent <RVOController>(); if (this.rvoController != null) { this.rvoController.enableRotation = false; } this.tr = base.transform; }
void CreateNavAgent() { var actorShowObj = ActorTransform.gameObject; seeker = actorShowObj.getOrAddComponent <Seeker>(); fmodifier = actorShowObj.getOrAddComponent <FunnelModifier>(); controller = actorShowObj.getOrAddComponent <RVOController>(); controller.center = new Int3(0, 1600, 0); Position = (Int3) new Vector3(0, 13, -41); controller.EnsureActorAndSimulator(); }
protected override void CopyData(BaseEvent src) { base.CopyData(src); FreezeActorDuration duration = src as FreezeActorDuration; this.targetId = duration.targetId; this.freezeHeight = duration.freezeHeight; this.actorObj = duration.actorObj; this.curAnimName = duration.curAnimName; this.rovController = duration.rovController; }
void Awake() { seeker = GetComponent <Seeker>(); controller = GetComponent <CharacterController>(); rvoController = GetComponent <RVOController>(); if (rvoController != null) { rvoController.enableRotation = false; } tr = transform; }
protected virtual void Awake() { this.seeker = base.GetComponent <Seeker>(); this.tr = base.transform; this.controller = base.GetComponent <CharacterController>(); this.rvoController = base.GetComponent <RVOController>(); if (this.rvoController != null) { this.rvoController.enableRotation = false; } this.rigid = base.GetComponent <Rigidbody>(); }
/** Initializes reference variables. * If you override this function you should in most cases call base.Awake () at the start of it. * */ protected virtual void Awake() { seeker = GetComponent <Seeker>(); // This is a simple optimization, cache the transform component lookup tr = transform; // Cache some other components (not all are necessarily there) controller = GetComponent <CharacterController>(); rvoController = GetComponent <RVOController>(); rigid = GetComponent <Rigidbody>(); }
public override void OnUse() { base.OnUse(); this.targetId = 0; this.freezeHeight = 0; this.recordSpeed = 0f; this.actorObj.Release(); this.curAnimName = null; this.rovController = null; this.forbidMove = true; this.IsFreeze = true; this.forbidSkill = true; }
void Awake() { //if(target!=null) // targetPosition = target.position; seeker = GetComponent <Seeker>(); controller = GetComponent <CharacterController>(); rvoController = GetComponent <RVOController>(); if (rvoController != null) { rvoController.enableRotation = false; } tr = transform; }
protected override void CopyData(BaseEvent src) { base.CopyData(src); FreezeActorDuration freezeActorDuration = src as FreezeActorDuration; this.targetId = freezeActorDuration.targetId; this.freezeHeight = freezeActorDuration.freezeHeight; this.actorObj = freezeActorDuration.actorObj; this.curAnimName = freezeActorDuration.curAnimName; this.rovController = freezeActorDuration.rovController; this.forbidMove = freezeActorDuration.forbidMove; this.forbidSkill = freezeActorDuration.forbidSkill; this.IsFreeze = freezeActorDuration.IsFreeze; }
public override void OnAwake() { // cache for quick lookup richAIAgent = gameObject.GetComponent <RichAIAgent>(); rvoController = gameObject.GetComponent <RVOController>(); if (richAIAgent.target == null) { var target = new GameObject(); target.name = Owner.name + " Target"; richAIAgent.target = target.transform; richAIAgent.repeatedlySearchPaths = false; } }
/** Initializes reference variables. * If you override this function you should in most cases call base.Awake () at the start of it. * */ protected virtual void Awake() { seeker = GetComponent <Seeker>(); //This is a simple optimization, cache the transform component lookup tr = transform; Stop(); //Cache some other components (not all are necessarily there) rvoController = GetComponent <RVOController>(); if (rvoController != null) { rvoController.enableRotation = false; } }
/** Initializes reference variables. * If you override this function you should in most cases call base.Awake () at the start of it. * */ protected virtual void Awake() { seeker = GetComponent <Seeker>(); //This is a simple optimization, cache the transform component lookup tr = transform; //Make sure we receive callbacks when paths complete seeker.pathCallback += OnPathComplete; //Cache some other components (not all are necessarily there) controller = GetComponent <CharacterController>(); navController = GetComponent <NavmeshController>(); rvoController = GetComponent <RVOController>(); rigid = rigidbody; }
/** Initializes reference variables. * If you override this function you should in most cases call base.Awake () at the start of it. * */ protected virtual void Awake() { seeker = GetComponent <Seeker>(); //This is a simple optimization, cache the transform component lookup tr = transform; //Cache some other components (not all are necessarily there) controller = GetComponent <CharacterController>(); navController = GetComponent <NavmeshController>(); rvoController = GetComponent <RVOController>(); if (rvoController != null) { rvoController.enableRotation = false; } rigid = rigidbody; }
public void Start() { controller = go.GetComponent <CharacterController>(); controller2 = go.GetComponent <RVOController>(); if (controller == null && controller2 == null) { if (AstarPath.HasPro) { controller2 = go.AddComponent <RVOController>(); controller2.Move(new Vector3(0, 0, 0)); } else { controller = go.AddComponent <CharacterController>(); } } UpdatePath(); }
public void Start() { controller = go.GetComponent <CharacterController>(); controller2 = go.GetComponent <RVOController>(); if (controller == null && controller2 == null) { if (AstarPath.HasPro) { controller2 = go.AddComponent <RVOController>(); } else { controller = go.AddComponent <CharacterController>(); } } CalculatePath(); }
// Use this for initialization public void Start () { #if RVOImp if (!astarRVO) { //#if !AstarRelease agentID = RVO.Simulator.Instance.addAgent(new RVO.Vector2(transform.position.x, transform.position.z)); //#endif } else { Pathfinding.RVO.Simulator sim = (FindObjectOfType(typeof(RVOSimulator)) as RVOSimulator).GetSimulator(); rvoAgent = sim.AddAgent(transform.position); rvoAgent.Radius = radius; rvoAgent.MaxSpeed = maxSpeed; rvoAgent.Height = height; rvoAgent.AgentTimeHorizon = agentTimeHorizon; rvoAgent.ObstacleTimeHorizon = obstacleTimeHorizon; } #endif SetTarget(-transform.position); // + transform.forward * 400); controller = GetComponent<RVOController>(); }
private void BeAutoPath() { // 增加RVO网格控制 m_RvoController = gameObject.AddComponent <RVOController>(); m_RvoController.agentTimeHorizon = 0.4f; // 检测代理碰撞的时间间隔 m_RvoController.obstacleTimeHorizon = 0.6f; // 检测其他障碍碰撞的时间间隔 m_RvoController.collidesWith = RVOLayer.DefaultAgent; m_RvoController.maxNeighbours = 2; m_RvoController.locked = false; // 寻路插件 m_AiPath = gameObject.AddComponent <AIPath>(); m_AiPath.radius = GetComponent <CircleCollider2D>().radius; m_AiPath.height = 1; m_AiPath.slowdownDistance = 0; // 无需减速 m_AiPath.enableRotation = true; m_AiPath.orientation = OrientationMode.YAxisForward; m_AiPath.slowWhenNotFacingTarget = false; m_AiPath.whenCloseToDestination = CloseToDestinationMode.ContinueToExactDestination; m_AiPath.rotationSpeed = m_RotationSpeed; m_AiPath.pickNextWaypointDist = 1; m_AiPath.repathRate = 0.2f; m_AiPath.whenCloseToDestination = CloseToDestinationMode.Stop; // 增加平滑曲线 m_SimpleSmooth = gameObject.AddComponent <SimpleSmoothModifier>(); m_SimpleSmooth.maxSegmentLength = 1f; m_SimpleSmooth.iterations = 5; RaycastModifier m_raycast = gameObject.AddComponent <RaycastModifier>(); m_raycast.quality = RaycastModifier.Quality.Low; m_raycast.useRaycasting = false; m_raycast.useGraphRaycasting = true; m_Seeker = GetComponent <Seeker>(); m_Seeker.drawGizmos = true; // 设置初始速度 m_AiPath.velocity2D = m_RvoController.velocity; m_PlayerCompt = Global.gApp.CurScene.GetMainPlayerComp(); m_PlayerGo = Global.gApp.CurScene.GetMainPlayer(); }
/// <summary> /// Awake this instance and initializes reference variables. /// </summary> /// <description> /// If you override this function you should in most cases call base.Awake () at the start of it. /// </description> protected virtual void Awake() { //just to optimize the transform component lookup m_Transform = transform; m_Controller = GetComponent <ICECreatureControl>(); m_CharacterController = GetComponent <CharacterController>(); #if RVOImp m_RVOController = GetComponent <RVOController>(); #endif m_Rigidbody = GetComponent <Rigidbody>(); if (m_Controller != null) { m_Controller.Creature.Move.OnTargetMovePositionReached += OnTargetMovePositionReached; m_Controller.Creature.Move.OnMoveComplete += OnMoveComplete; m_Controller.Creature.Move.OnUpdateMovePosition += OnMoveUpdatePosition; } }
public override void OnAwake() { // Cache Variables info = npcInfo.GetValue() as NPCInfo; pathSeeker = seeker.GetValue() as Seeker; if (triggerAnimation) { anim = animator.GetValue() as Animator; AnimatorControllerParameter[] parameters = anim.parameters; triggers = new List <string>(); for (int i = 0; i < parameters.Length; i++) { triggers.Add(parameters[i].name); } } if (useRVO) { controller = rvoController.GetValue() as RVOController; } }
// Use this for initialization void Awake() { mEnemyTrans = new List <Transform>(); //mForceAttackList = new List<Transform>(); mUnitData = new UnitData(); mRVOController = transform.GetComponent <RVOController>(); mRichAI = transform.GetComponent <RichAI>(); mThinkTime = mThinkTimeSpace; mUnitAnimation = GetComponentInChildren <Animation>(); InitAwake(); mIdleState.mdGetInState += UnitIdleGetInFunc; mIdleState.mdGetOutState += UnitIdleGetOutFunc; mIdleState.mdExcuteState += UnitIdleExcuteFunc; mWalkState.mdGetInState += UnitWalkGetInFunc; mWalkState.mdExcuteState += UnitWalkExcuteFunc; mWalkState.mdGetOutState += UnitWalkGetOutFunc; mAttackState.mdGetInState += UnitAttackGetInFunc; mAttackState.mdExcuteState += UnitAttackExcuteFunc; mAttackState.mdGetOutState += UnitAttackGetOutFunc; mPrepareState.mdGetInState += UnitPrepareGetInFunc; mPrepareState.mdExcuteState += UnitPrepareExcuteFunc; mPrepareState.mdGetOutState += UnitPrepareGetOutFunc; mDieState.mdGetInState += UnitDieGetInFunc; mDieState.mdExcuteState += UnitDieExcuteFunc; mDieState.mdGetOutState += UnitDieGetOutFunc; mStateMachine.StartWorking(); //the Event handlers SetUpEventHandlers(); }
/** Initializes reference variables. * If you override this function you should in most cases call base.Awake () at the start of it. * */ protected virtual void Awake () { seeker = GetComponent<Seeker>(); //This is a simple optimization, cache the transform component lookup tr = transform; //Cache some other components (not all are necessarily there) controller = GetComponent<CharacterController>(); navController = GetComponent<NavmeshController>(); rvoController = GetComponent<RVOController>(); rigid = rigidbody; }
void Start() { rvo = GetComponent<RVOController>(); rvo.Move(Vector3.right * speed); rvo.maxSpeed = speed; }
public void Start() { this.SetTarget(-base.transform.position); this.controller = base.GetComponent<RVOController>(); }
void Start() { gameCamera = GameObject.Find("Main Camera").GetComponent<Camera>(); rvo = GetComponent<RVOController>(); }
/** Initializes reference variables. * If you override this function you should in most cases call base.Awake () at the start of it. * */ protected virtual void Awake () { seeker = GetComponent<Seeker>(); //This is a simple optimization, cache the transform component lookup tr = transform; //Cache some other components (not all are necessarily there) controller = GetComponent<CharacterController>(); rvoController = GetComponent<RVOController>(); if (rvoController != null) rvoController.enableRotation = false; rigid = GetComponent<Rigidbody>(); }