Пример #1
0
        /// <summary>
        /// 用来获得红方或者蓝方
        /// </summary>
        /// <param name="actorSide"></param>
        /// <returns></returns>
        public static ActorSide GetOpSide(ActorSide actorSide)
        {
            switch (actorSide)
            {
            case ActorSide.blue:
                return(ActorSide.red);

            case ActorSide.red:
                return(ActorSide.blue);
            }
            return(ActorSide.neutral);
        }
Пример #2
0
        /// <summary>
        /// </summary>
        /// <param name="index"></param>
        /// <returns></returns>
        public Vector3 GetBirthPosition(int index, ActorSide side)
        {
            if (ActorSide.blue == side)
            {
                var blueCenter = new Vector3(4, 0, 4);
                blueCenter.x -= (index * 2);
                return(blueCenter);
            }

            if (ActorSide.red == side)
            {
                var redCenter = new Vector3(4, 0, -4);
                redCenter.x -= (index * 2);
                return(redCenter);
            }

            return(Vector3.zero);
        }
Пример #3
0
        /// <summary>
        /// 获取不是自身的side
        /// </summary>
        /// <param name="src"></param>
        /// <param name="dst"></param>
        /// <returns></returns>
        public static SideRelation GetSideRelation(ActorSide src, ActorSide dst)
        {
            switch (src)
            {
            case ActorSide.red:
                switch (dst)
                {
                case ActorSide.red:
                    return(SideRelation.friend);

                case ActorSide.blue:
                    return(SideRelation.enemy);

                case ActorSide.neutral:
                    return(SideRelation.neutral);
                }
                break;

            case ActorSide.blue:
                switch (dst)
                {
                case ActorSide.red:
                    return(SideRelation.enemy);

                case ActorSide.blue:
                    return(SideRelation.friend);

                case ActorSide.neutral:
                    return(SideRelation.neutral);
                }
                break;

            case ActorSide.neutral:
                return(SideRelation.neutral);
            }
            return(SideRelation.neutral);
        }
Пример #4
0
        /// <summary>
        /// aoe类型的buff需要检测更新生效的actor
        /// </summary>
        public void UpdateEffectActorList()
        {
            if (mBuffCfg.mEffectRangeType != EffectRangeType.Aoe)
            {
                return;
            }
            //检查上一次的受击者是否离开范围,并且移除
            foreach (var actor in mEfxActors)
            {
                if (!IsInEfxRange(actor.CacheTransform.position))
                {
                    actor.GetBuffCmpt().RemoveBuff(this);
                }
            }

            ActorSide ownActorSide = OwnActor.GetActorSide();

            //todo 包围盒子配置
            var halfSize   = new Vector3(mBuffCfg.mEffectRange, 1, mBuffCfg.mEffectRange);
            var overlapBox = Physics.OverlapBox(OwnActor.CacheTransform.position, halfSize, Quaternion.identity, SystemPreset.layer_actor);

            foreach (var collider in overlapBox)
            {
                var targetActor  = collider.GetComponent <GameActor>();
                var sideRelation = Toolkit.GetSideRelation(ownActorSide, targetActor.GetActorSide());

                if (mBuffCfg.IsInEffectRelation(sideRelation))
                {
                    if (!mEfxActors.Contains(targetActor))
                    {
                        AddBuffEffect(targetActor);
                        mEfxActors.Add(targetActor);
                    }
                }
            }
        }
Пример #5
0
 public Bullet(Vector2 position, Vector2 velocity, ActorSide side) : base("gyoza", position, 16, 16, side)
 {
     this.velocity = velocity;
 }
Пример #6
0
 public void SetActorSide(ActorSide side)
 {
     mActorSide = side;
 }
Пример #7
0
 public bool IsInEffectSide(ActorSide side)
 {
     return(mEffectSide.Contains(side));
 }
Пример #8
0
        public List <Character> GetCharacters(ActorSide side)
        {
            List <Character> c = GetCharactersRef(side);

            return(c);
        }
Пример #9
0
 private List <Character> GetCharactersRef(ActorSide side)
 {
     return(characters[(int)side]);
 }
Пример #10
0
        public Character(string assetName, Vector2 position, Vector2 imageSize, float size, ActorSide actorSide, int endurance = 1, int score = 1)
        {
            this.actorSide   = actorSide;
            this.assetName   = assetName;
            this.score       = score;
            this.size        = size;
            this.endurance   = endurance;
            characterManager = CharacterManager.GetInstance();
            GameDevice device = GameDevice.Instance();

            renderer       = device.GetRenderer();
            this.imageSize = imageSize;
            this.position  = position - imageSize / 2;
        }
Пример #11
0
 public Character(string assetName, Vector2 position, float imageOneSideSize, float size, ActorSide actorSide, int endurance = 1, int score = 1)
     : this(assetName, position, Vector2.One *imageOneSideSize, size, actorSide, endurance, score)
 {
 }