Inheritance: MonoBehaviour
コード例 #1
0
	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;
	}
コード例 #2
0
ファイル: Command.cs プロジェクト: Lomztein/Microsquad
 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;
 }
コード例 #3
0
ファイル: Command.cs プロジェクト: Lomztein/Microsquad
    // 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;
    }
コード例 #4
0
ファイル: Command.cs プロジェクト: Lomztein/Microsquad
    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;
    }
コード例 #5
0
ファイル: Character.cs プロジェクト: rogeryuan99/Hello
 public virtual void getCharacterAI()
 {
     this.characterAI = gameObject.GetComponent<CharacterAI>();
 }
コード例 #6
0
 void Start()
 {
     skeleton = GetComponentsInChildren<Rigidbody>();
     animator = GetComponent<Animator>();
     characterAI = GetComponent<CharacterAI>();
 }
コード例 #7
0
    public Collider2D currentTarget;//所要攻击的目标

    public IceSlimeBoss(GameObject myBody, CharacterAI AI, ICharacterAttr attr) : base(myBody, AI, attr)
    {
        myBody.GetComponent <IceSlimeBossBody>().SetCharacter(this);
    }
コード例 #8
0
ファイル: BrainFear.cs プロジェクト: Ant0nin/GGJ18
 public override void Plug(Collider2D col, CharacterAI ai, Rigidbody2D rb, Animator anim)
 {
     this.speed = CharacterAI.speedRun;
 }
コード例 #9
0
ファイル: BrainCourage.cs プロジェクト: Ant0nin/GGJ18
 public override void Plug(Collider2D col, CharacterAI ai, Rigidbody2D rb, Animator anim)
 {
     frameCount = 100;
 }
コード例 #10
0
ファイル: BrainNeutral.cs プロジェクト: Ant0nin/GGJ18
 public override void Unplug(Collider2D col, CharacterAI ai, Rigidbody2D rb, Animator anim)
 {
 }
コード例 #11
0
    public Collider2D currentTarget; //当前追逐或者攻击的目标

    public IceSlime1(GameObject myBody, CharacterAI AI, ICharacterAttr attr, GameObject iceBullet) : base(myBody, AI, attr)
    {
        myBody.GetComponent <IceSlime1Body>().SetCharacter(this);
        SetIceBullet(iceBullet);
    }
コード例 #12
0
ファイル: BrainNeutral.cs プロジェクト: Ant0nin/GGJ18
 public override void CollisionEnterDelegate(Collision2D col, CharacterAI ai, Rigidbody2D rb, Animator anim)
 {
 }
コード例 #13
0
 public AttackState(CharacterAI characterAI)
 {
     enemyAI = characterAI;
 }
コード例 #14
0
	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>();
	}
コード例 #15
0
ファイル: BrainNeutral.cs プロジェクト: Ant0nin/GGJ18
 public override void TriggerEndDelegate(Collider2D col, CharacterAI ai, Rigidbody2D rb, Animator anim)
 {
 }
 void Start()
 {
     _realPosition = transform.position;
     _characterController = GetComponent<CharacterController>();
     _ai = GetComponent<CharacterAI>();
 }
コード例 #17
0
 public FollowState(CharacterAI characterAI)
 {
     enemyAI = characterAI;
 }