void Awake() { capsule = GetComponent<CapsuleCollider>(); grabTriggerCol = GetComponent<BoxCollider>(); anim = GetComponent<Animator> (); _charStatus = GetComponent<CharacterStatus> (); _charAttacking = GetComponent<CharacterAttacking> (); _charAI = GetComponent<CharacterAI> (); if (!IsEnemy) { _playerInput = GetComponent<PlayerInput>(); //_playerInputMobile = GetComponent<PlayerInputMobile>(); } // I use these since when we have low health, we will move a bit slower. // When we get more than 25% health again, we will go back to our // default speeds for these. defaultAirSpeed = airSpeed; m_Loco_0Id = Animator.StringToHash ("Base Layer.Locomotion"); m_Loco_1Id = Animator.StringToHash ("LowHealth.Locomotion"); myRigidbody = GetComponent<Rigidbody> (); if (!grabTriggerCol) Debug.LogWarning("PLEASE ASSIGN YOUR Player's GRAB TRIGGER COLLIDER"); else grabTriggerCol.enabled = false; }
public static Command KillCommand(Transform target, CharacterAI character, float health) { Command k = Command.CreateInstance <Command> (); k.name = "Kill: " + target.name; k.time = character.character.CalcDPS () / health; k.position = target.position; k.type = Type.Kill; k.target = target; character.AddCommand (k); return k; }
// Todo, create a "Basic command", which just fills out the command informtion with basic data. public static Command MoveCommand( Vector3 start, Vector3 end, CharacterAI character ) { Command c = Command.CreateInstance<Command> (); c.name = "Move: " + end.ToString (); float d = Vector3.Distance (start, end); c.time = d / character.character.speed; c.position = end; c.type = Type.Move; character.AddCommand (c); return c; }
public static Command InteractCommand(Transform target, CharacterAI character, string interactCommand, float interactRange = 5f) { Command i = Command.CreateInstance<Command> (); i.metadata = interactCommand; i.name = "Interact: " + target.name + " with " + interactCommand; i.time = Vector3.Distance (character.transform.position, target.position) / character.character.speed; i.position = target.position; i.type = Type.Interact; i.target = target; i.attributes.AddAttribute ("InteractRange", interactRange); character.AddCommand (i); return i; }
public virtual void getCharacterAI() { this.characterAI = gameObject.GetComponent<CharacterAI>(); }
void Start() { skeleton = GetComponentsInChildren<Rigidbody>(); animator = GetComponent<Animator>(); characterAI = GetComponent<CharacterAI>(); }
public Collider2D currentTarget;//所要攻击的目标 public IceSlimeBoss(GameObject myBody, CharacterAI AI, ICharacterAttr attr) : base(myBody, AI, attr) { myBody.GetComponent <IceSlimeBossBody>().SetCharacter(this); }
public override void Plug(Collider2D col, CharacterAI ai, Rigidbody2D rb, Animator anim) { this.speed = CharacterAI.speedRun; }
public override void Plug(Collider2D col, CharacterAI ai, Rigidbody2D rb, Animator anim) { frameCount = 100; }
public override void Unplug(Collider2D col, CharacterAI ai, Rigidbody2D rb, Animator anim) { }
public Collider2D currentTarget; //当前追逐或者攻击的目标 public IceSlime1(GameObject myBody, CharacterAI AI, ICharacterAttr attr, GameObject iceBullet) : base(myBody, AI, attr) { myBody.GetComponent <IceSlime1Body>().SetCharacter(this); SetIceBullet(iceBullet); }
public override void CollisionEnterDelegate(Collision2D col, CharacterAI ai, Rigidbody2D rb, Animator anim) { }
public AttackState(CharacterAI characterAI) { enemyAI = characterAI; }
void Awake() { _charMotor = GetComponent<CharacterMotor> (); if (!IsEnemy) { _playerInput = GetComponent<PlayerInput>(); _playerInputMobile = GetComponent<PlayerInputMobile>(); } _charAttacking = GetComponent<CharacterAttacking> (); _characterAI = GetComponent<CharacterAI> (); anim = GetComponent<Animator> (); _myCapsuleCol = GetComponent<CapsuleCollider> (); // Gather all of our skinned meshes. mySkinnedMeshes = transform.GetComponentsInChildren<SkinnedMeshRenderer> (); // Find all of our total materials now so we don't have to do it later. If curious why I do this // check the docs on Unity's scripting reference for renderer.material or renderer.materials. // They say to destroy any created instances of materials in OnDestroy() _totalMats = new int[mySkinnedMeshes.Length]; for(int i = 0; i < mySkinnedMeshes.Length; i++) _totalMats[i] = mySkinnedMeshes [i].materials.Length; myRigidbody = GetComponent<Rigidbody>(); _myAudio = GetComponent<AudioSource>(); TargetedByCharacters = new List<Transform>(); }
public override void TriggerEndDelegate(Collider2D col, CharacterAI ai, Rigidbody2D rb, Animator anim) { }
void Start() { _realPosition = transform.position; _characterController = GetComponent<CharacterController>(); _ai = GetComponent<CharacterAI>(); }
public FollowState(CharacterAI characterAI) { enemyAI = characterAI; }