void UpdatePosition(Vector3 holderPos) { Vector3 dir = holderPos.normalized; float len = holderPos.sqrMagnitude; if (len > m_nSqrRadius) { len = m_nRadius; holderPos = dir * len; } if (EntityManager.instance.curEntity != null) { Transform et = EntityManager.instance.curEntity; Animator animator = et.gameObject.GetComponentInChildren <Animator>(); animator.SetFloat("curDirX", dir.x); animator.SetFloat("curDirY", dir.y); animator.SetFloat("curDirZ", dir.z); animator.SetFloat("speed", 5); EntityAnimator eanimator = et.gameObject.GetComponentInChildren <EntityAnimator>(); eanimator.Play(EAnimationType.Move, 1.0f); } //DataBuffer buf = new DataBuffer(); //buf.WriteFloat(dir.x); //buf.WriteFloat(dir.y); //buf.WriteFloat(dir.z); //GameEvtArg arg = new GameEvtArg(buf); //m_EvtCtx.FireEvent(this, GameEventType.EVT_INPUT_JOYSTICK_DIR_CHANGED, arg); m_rectTransform.anchoredPosition = holderPos; }
void Awake() { rb = GetComponent <Rigidbody>(); col = transform.GetComponentInChildren <Collider>(); animator = GetComponentInChildren <EntityAnimator>(); debugText = GetComponentInChildren <Text>(); currentHealth = maxHealth; }
public AbilitySimpleTarget(MobaEntity attacker, MobaEntity target, Ability ability) { m_ability = ability; m_attacker = attacker; m_attacker.StopAgent(false); m_attackerAbilities = m_attacker.GetComponent <EntityAbilities>(); m_attackerAnimator = m_attacker.GetComponent <EntityAnimator>(); Target = target; }
public AbilitySimpleTarget(MobaEntity attacker, MobaEntity[] targets, Ability ability) { m_targets = targets; m_ability = ability; m_attacker = attacker; m_attacker.StopAgent(false); m_attackerAbilities = m_attacker.GetComponent <EntityAbilities>(); m_attackerAnimator = m_attacker.GetComponent <EntityAnimator>(); //m_attacker.EntityAbilities.IsCasting = true; }
void Awake() { m_animator = gameObject.GetComponent <EntityAnimator>(); m_uid = gameObject.GetHashCode(); m_fsmDict = new Dictionary <string, BaseFSM>(); m_actionMgr = new ActionManager(); //LogicEntityFSM entityFSM = FSMManager.instance.CreateFSM("EntityActionFSM") as LogicEntityFSM; //entityFSM.entityview = this; //m_fsmDict.Add("EntityActionFSM", entityFSM); }
public AbilitySimplePosition(MobaEntity attacker, Vector2 targetPos, Ability ability) { m_targetPos = targetPos; m_ability = ability; m_attacker = attacker; m_attacker.StopAgent(false); m_attackerAbilities = m_attacker.GetComponent <EntityAbilities>(); m_attackerAnimator = m_attacker.GetComponent <EntityAnimator>(); m_attacker.EntityAbilities.IsCasting = true; }
void OnHandleInput(object sender, EventArgs arg) { GameEvtArg garg = arg as GameEvtArg; if (garg != null && garg.m_buf != null) { int i = garg.m_buf.ReadByte(); EntityAnimator animator = curEntity.gameObject.GetComponent <EntityAnimator>(); if (animator == null) { return; } switch (i) { case 0: { animator.Play(EAnimationType.LPunch, 1); } break; case 1: { animator.Play(EAnimationType.RPunch, 1); } break; case 2: { animator.Play(EAnimationType.LPunchMove, 1); } break; case 3: { animator.Play(EAnimationType.RPunchMove, 1); } break; case 4: { animator.Play(EAnimationType.LKick, 1); } break; case 5: { animator.Play(EAnimationType.RKick, 1); } break; } } }
public override void OnStartState() { base.OnStartState(); if (entityview == null) { Goto(timeOutState); } m_animator = entityview.animator; if (m_animator != null) { m_animator.Play(m_animType, m_animationSpeed); } }
void Awake() { _entity = GetComponent <Entity>(); _aggro = GetComponent <EntityAggro>(); _animator = GetComponent <EntityAnimator>(); // EARLY OUT! // if (this.DisabledFromMissingObject(_entity, _aggro, GetComponent <Rigidbody>())) { return; } _entity.SpawnedEvent.AddListener(onSpawned); }
public override void OnEnterState() { base.OnEnterState(); m_animator = curFSM.entityview.animator; entityview = curFSM.entityview; object obj = Enum.Parse(typeof(EAnimationType), m_animation); if (obj != null) { m_animType = (EAnimationType)obj; } else { m_animType = EAnimationType.Stand; } }
public virtual void Awake() { m_entityLogic = GetComponent <Logic>(); m_entityBehaviour = GetComponent <EntityBehaviour>(); m_entityAbilities = GetComponent <EntityAbilities>(); m_entityAnimator = GetComponent <EntityAnimator>(); m_entityCanvas = GetComponent <EntityCanvas>(); m_entityTranforms = transform.GetComponentsInChildren <EntityTransform>(true); m_entityLabel = GetComponent <EntityCanvas>(); m_pathRenderer = Utils.CreateLineRendererObject(this, true); Transform model = GetTransformPosition(EEntityTransform.Model).transform; m_renderer = model.GetComponent <Renderer>(); if (m_renderer == null) { m_renderer = model.GetComponentInChildren <Renderer>(true); } }
public virtual void Die(DamageProcess damageProcess) { if (OnDeathCallBack != null) { OnDeathCallBack(damageProcess); } m_entityAbilities.RemoveAllSideEffects(); EntityBehaviour.StopAllBehaviours(); StopAgent(false); m_dead = true; EntityAnimator.ChangeState(EEntityState.Dead); if (!string.IsNullOrEmpty(DeathParticlePrefab)) { RpcSpawnDeathParticle(); m_deathParticle = SpawnManager.instance.InstantiatePool(DeathParticlePrefab, Vector3.zero, Quaternion.identity); EntityTransform canvasTrasnform = GetTransformPosition(DeathParticlePosition); m_deathParticle.transform.SetParent(canvasTrasnform.transform); m_deathParticle.transform.localPosition = Vector3.zero; } switch (RespawnType) { case EEntityRespawnType.NoRespawn: break; case EEntityRespawnType.NoRespawnAndDestroy: StartCoroutine(NoRespawnAndDestroyCoroutine()); break; case EEntityRespawnType.RespawnAndReset: StartCoroutine(RespawnAndResetCoroutine()); break; default: break; } }
// Use this for initialization void Start() { shootTimer = timeBetweenShots; animator = GetComponent <EntityAnimator>(); StartCoroutine(UpdateAI()); }
public override void _Ready() { entityAnimator = (EntityAnimator)GetParent(); }