示例#1
0
 public Checkers(AbstractCharacterController controller) : base(controller)
 {
     VisibilityRange = 2000;//900
     //Character.Spacemap.EntityAdded += AddedToSpacemap;
     //Character.Spacemap.EntityRemoved += RemovedFromSpacemap;
     Character.Spacemap.RemovedObject += SpacemapOnRemovedObject;
 }
 private void Start()
 {
     parentCharacterController = transform.parent.gameObject.GetComponent <AbstractCharacterController>();
     if (parentCharacterController == null)
     {
         Debug.LogError("parentCharacterController in Attack Controller not found!");
     }
     parentStateMachine = transform.parent.gameObject.GetComponent <IStateMachine>();
     if (parentStateMachine == null)
     {
         Debug.LogError("parentStateMachine in Attack Controller not found!");
     }
 }
示例#3
0
        private void OnEnable()
        {
            //this.behavior = target as BasicCharacterController;
            mb = target as AbstractCharacterController;

            ani = mb.GetComponent <Animator>();

            this.moveTypeProp  = serializedObject.FindProperty("moveType");
            this.worldTypeProp = serializedObject.FindProperty("worldType");
            this.inputTypeProp = serializedObject.FindProperty("inputType");
            this.dirTypeProp   = serializedObject.FindProperty("dirType");
            this.spaceTypeProp = serializedObject.FindProperty("spaceType");

            this.hAxisProp = serializedObject.FindProperty("horizontalAxis");
            this.vAxisProp = serializedObject.FindProperty("verticalAxis");
            this.lKeyProp  = serializedObject.FindProperty("leftKey");
            this.rKeyProp  = serializedObject.FindProperty("rightKey");
            this.uKeyProp  = serializedObject.FindProperty("upKey");
            this.dKeyProp  = serializedObject.FindProperty("downKey");

            this.autoFitProp = serializedObject.FindProperty("FitDirByLocalScale");

            this.idleAniNameProp  = serializedObject.FindProperty("idleAniName");
            this.idleAniIndexProp = serializedObject.FindProperty("idleAniIndex");

            this.enableWalkProp   = serializedObject.FindProperty("enableWalk");
            this.walkScalerProp   = serializedObject.FindProperty("walkScaler");
            this.walkAniNameProp  = serializedObject.FindProperty("walkAniName");
            this.walkAniIndexProp = serializedObject.FindProperty("walkAniIndex");

            this.enableRunProp   = serializedObject.FindProperty("enableRun");
            this.runScalerProp   = serializedObject.FindProperty("runScaler");
            this.runAniNameProp  = serializedObject.FindProperty("runAniName");
            this.runAniIndexProp = serializedObject.FindProperty("runAniIndex");

            this.enableDashProp   = serializedObject.FindProperty("enableDash");
            this.dashAniNameProp  = serializedObject.FindProperty("dashAniName");
            this.dashAniIndexProp = serializedObject.FindProperty("dashAniIndex");
            this.dashDistanceProp = serializedObject.FindProperty("dashDistance");
            this.dashKeyProp      = serializedObject.FindProperty("dashKey");
            this.dashArgProp      = serializedObject.FindProperty("dashTime");
            this.lerpTypeProp     = serializedObject.FindProperty("lerpType");

            this.enableSquatProp   = serializedObject.FindProperty("enableSquat");
            this.squatKeyProp      = serializedObject.FindProperty("squatKey");
            this.squatAniNameProp  = serializedObject.FindProperty("squatAniName");
            this.squatAniIndexProp = serializedObject.FindProperty("squatAniIndex");
        }
    void OnCollisionEnter2D(Collision2D collision)
    {
        Debug.Log("CollisionEnter");

        AttackDetails attack = parentStateMachine.GetCurrentAttackDetails();

        if (attack == null)
        {
            Debug.LogError("Parent CharacterController is not in state attacking!");
            return;
        }
        float maxHitContactY = GetMaxHitContactY(collision);
        float hitDirectionX  = GetHitDirection(parentCharacterController.transform, collision);

        if (ListContainsTag(parentCharacterController.opponentTags, collision.gameObject.tag))
        {
            AbstractCharacterController opponentCharacterController = collision.gameObject.GetComponent <AbstractCharacterController>();

            if (opponentCharacterController)
            {
                opponentCharacterController.ReceiveDamage(hitDirectionX, maxHitContactY, attack);
            }
            else
            {
                Debug.LogError("No AbstractCharacterController Script for player found. No damage served today!");
            }
        }

        if (ListContainsTag(parentCharacterController.destructableTags, collision.gameObject.tag))
        {
            AbstractDestructableController destructableController = collision.gameObject.GetComponent <AbstractDestructableController>();

            if (destructableController)
            {
                destructableController.ReceiveDamage(hitDirectionX, maxHitContactY, attack);
            }
            else
            {
                Debug.LogError("No AbstractDestructableController Script for player found. No damage served today!");
            }
        }
    }
示例#5
0
 public Heal(AbstractCharacterController controller) : base(controller)
 {
 }
示例#6
0
 public Effects(AbstractCharacterController controller) : base(controller)
 {
 }
示例#7
0
 public Destruction(AbstractCharacterController controller) : base(controller)
 {
 }
示例#8
0
 public Attack(AbstractCharacterController controller) : base(controller)
 {
 }
示例#9
0
 public IAbstractCharacter(AbstractCharacterController controller)
 {
     Controller = controller;
 }
示例#10
0
 public Damage(AbstractCharacterController controller) : base(controller)
 {
 }