Пример #1
0
 public PlayerWeapon(List<DrawableObjectAbstract> pipeline, CharacterAbstract character,
     GameTexture animation, Vector2 gunHandle, AmmoTypeEnum ammoType, int clipSize)
     : base(pipeline, character, animation, gunHandle, ammoType, clipSize)
 {
     laserImage_ = TextureMap.fetchTexture(TARGET_TEXTURE_NAME);
     weaponFired_ = false;
 }
Пример #2
0
 public ThrowGrenadeAction(CharacterAbstract character,
     AnimationInterface[] animation,
     Vector2 throwOffset,
     string actionLevel)
     : this(character, animation, throwOffset, actionLevel, 0, 0)
 {
 }
Пример #3
0
 public Missile(List<DrawableObjectAbstract> pipeline, CollisionDetectorInterface detector, CharacterAbstract target)
     : base(pipeline, TextureMap.fetchTexture(TEXTURE_NAME), detector, null, RADIUS, HEIGHT, Vector2.Zero, Vector2.Zero, Vector2.Zero, DEPTH)
 {
     damage_ = DAMAGE;
     boundsPolygon_ = new ConvexPolygon(BOUNDS_POINTS, Vector2.Zero);
     target_ = target;
 }
        internal override bool initialize()
        {
            target = (handle_ as CharacterAbstract);
            aiming = new SystemAiming(character_.AI_, target);

            return true;
        }
Пример #5
0
 public MultiLevelActuator(Dictionary<string, Dictionary<string, CharacterActionInterface>> actions, List<string> actionLevels, CharacterAbstract character, string initialActionSet, string initialAction, string lowActionLevel, string highActionLevel)
 {
     if (ActionSetValidator.validate(actions))
     {
         actions_ = actions;
     }
     else
     {
         throw new InvalidActionSetException("This action set is invalid for the DefaultActuator");
     }
     character_ = character;
     currentActionSet_ = initialActionSet;
     actionLevels_ = actionLevels;
     CharacterActionInterface initAction = actions_[currentActionSet_][initialAction];
     currentActions_ = new Dictionary<string, CharacterActionInterface>();
     foreach (string s in actionLevels_)
     {
         currentActions_.Add(s, initAction);
     }
     restingAction_ = RESTINGSTATE;
     lowActionLevel_ = lowActionLevel;
     highActionLevel_ = highActionLevel;
     currentAnimationSet_ = 0;
     resources_ = new Dictionary<int, Object>();
     toPause_ = false;
 }
Пример #6
0
 public MultiLevelActuator(Dictionary<string, Dictionary<string, CharacterActionInterface>> actions, List<string> actionLevels, CharacterAbstract character, string initialActionSet)
     : this(actions, actionLevels, character, initialActionSet, RESTINGSTATE, actionLevels[0], "")
 {
     if (actionLevels.Count > 1)
     {
         highActionLevel_ = actionLevels_[1];
     }
 }
Пример #7
0
 public BigBossGatlingGuns(List<DrawableObjectAbstract> pipeline, CharacterAbstract character, Vector2 gunHandle)
     : base(pipeline, character, gunHandle)
 {
     gunTip_ = 0f;
     ClipSize_ = 100;
     CurrentAmmo_ = ClipSize_;
     pistol_ = true;
 }
Пример #8
0
 public MachineGun(List<DrawableObjectAbstract> pipeline, CharacterAbstract character, Vector2 gunHandle)
     : base(pipeline, character, TextureMap.fetchTexture(WEAPON_TEXTURE_NAME), gunHandle, AMMO_TYPE, CLIP_SIZE)
 {
     SOUND_RADIUS = MACHINE_GUN_SOUND_RADIUS;
     drawOffset_ = DRAW_OFFSET;
     gunTip_ = gunLength_ / 2f + DRAW_OFFSET;
     CurrentAmmo_ = CLIP_SIZE;
 }
Пример #9
0
 public Pistol(List<DrawableObjectAbstract> pipeline, CharacterAbstract character, Vector2 gunHandle)
     : base(pipeline, character, TextureMap.fetchTexture(WEAPON_TEXTURE_NAME), gunHandle, AMMO_TYPE, CLIP_SIZE)
 {
     laserImage_ = TextureMap.fetchTexture(TARGET_TEXTURE_NAME);
     SOUND_RADIUS = PISTOL_SOUND_RADIUS;
     CurrentAmmo_ = CLIP_SIZE;
     pistol_ = true;
 }
 public CharacterShootAction(CharacterAbstract character,
     AnimationInterface[] animation,
     string actionLevel,
     int shootFrame)
 {
     character_ = character;
     animation_ = animation;
     actionLevel_ = actionLevel;
     shootFrame_ = shootFrame;
     finished_ = true;
 }
 public CharacterCoverShootAction(CharacterAbstract character,
     AnimationInterface[] animation,
     int frameToShoot,
     string actionLevel)
 {
     character_ = character;
     animation_ = animation;
     frameToShoot_ = frameToShoot;
     priority_ = PRIORITY;
     actionLevel_ = actionLevel;
     actuator_ = null;
 }
 public CharacterCoverMoveToAction(CharacterAbstract character, 
     AnimationInterface animation,
     float speed,
     string actionLevel)
 {
     priority_ = PRIORITY;
     character_ = character;
     animation_ = animation;
     speed_ = speed;
     moveTo_ = Vector2.Zero;
     finished_ = true;
     actionLevel_ = actionLevel;
 }
Пример #13
0
 public CrouchAction(CharacterAbstract character,
     AnimationInterface animation,
     String nextActionSet,
     Height newHeight,
     string actionLevel)
 {
     priority_ = PRIORITY;
     character_ = character;
     animation_ = animation;
     nextActionSet_ = nextActionSet;
     finished_ = false;
     newHeight_ = newHeight;
     actionLevel_ = actionLevel;
 }
Пример #14
0
 public CharacterRunAction(CharacterAbstract character,
     AnimationInterface animation,
     float speed,
     string actionLevel)
 {
     character_ = character;
     animation_ = animation;
     speed_ = speed;
     moved_ = Vector2.Zero;
     runDirection_ = Vector2.Zero;
     priority_ = RUNPRIORITY;
     finished_ = true;
     actionLevel_ = actionLevel;
 }
Пример #15
0
 public DefaultActuator(Dictionary<string, Dictionary<string, CharacterActionInterface>> actions, CharacterAbstract character, string initialActionSet)
 {
     if (ActionSetValidator.validate(actions))
     {
         actions_ = actions;
     }
     else
     {
         throw new InvalidActionSetException("This action set is invalid for the DefaultActuator");
     }
     character_ = character;
     currentActionSet_ = initialActionSet;
     currentAction_ = actions_[currentActionSet_]["rest"];
     currentAction_.update();
 }
Пример #16
0
 public ThrowGrenadeAction(CharacterAbstract character,
     AnimationInterface[] animation,
     Vector2 throwOffset,
     string actionLevel,
     int holdFrame,
     int throwFrame)
 {
     character_ = character;
     animation_ = animation;
     throwOffset_ = throwOffset;
     priority_ = PRIORITY;
     finished_ = true;
     actionLevel_ = actionLevel;
     holdFrame_ = holdFrame;
     throwFrame_ = throwFrame;
     endFrame_ = animation_[0].getNumFrames();
 }
 public CharacterLookAtAction(CharacterAbstract character,
     string actionLevel)
 {
     character_ = character;
     actionLevel_ = actionLevel;
     priority_ = PRIORITY;
     newDirection_ = Vector2.Zero;
     location_ = Vector2.Zero;
     finished_ = true;
     if (character_ is BigBoss)
     {
         turnSpeed = TURNSPEED / 20f;
     }
     else
     {
         turnSpeed = TURNSPEED;
     }
 }
 public DetachFromCoverAction(CharacterAbstract character,
     AnimationInterface animation,
     String nextActionSet,
     Height nextHeight,
     float speed,
     string actionLevel)
 {
     character_ = character;
     animation_ = animation;
     priority_ = PRIORITY;
     coverObject_ = null;
     positionToMoveTo_ = Vector2.Zero;
     finished_ = false;
     speed_ = speed;
     nextActionSet_ = nextActionSet;
     nextHeight_ = nextHeight;
     actionLevel_ = actionLevel;
 }
Пример #19
0
        internal override bool initialize()
        {
            enemy_ = (handle_ as CharacterAbstract);

            Belief belief = character_.AI_.Memory_.getBelief(BeliefType.EnemyLoc, handle_);

            if ((enemy_ == null) || (belief == null))
            {
                return false;
            }

            //(character_.getActuator() as DefaultActuator).throwGrenade(
            character_.getActuator().perform("throw", new ActionParameters(
                            new FragGrenade(character_.pipeline_,
                    character_.getCollisionDetector(),
                    belief.position_ - character_.getPosition(),
                    character_.getPosition(),
                    character_.getDirection())
            ));

            return true;
        }
 public CharacterStayStillAction(CharacterAbstract character,
     AnimationInterface[] animation,
     List<string> actionLevels,
     string highActionLevel,
     string lowActionLevel)
 {
     priority_ = PRIORITY;
     character_ = character;
     animation_ = animation;
     actionLevels_ = actionLevels;
     numberAnimations_ = animation.GetLength(0);
     numberActionLevels_ = actionLevels_.Count;
     if (numberAnimations_ % numberActionLevels_!= 0)
     {
         throw new Exception("CharacterStayStillAction must have a number of animations\n" +
                             "that is divisible by the number of action levels!");
     }
     animationsToDraw_ = new int[numberActionLevels_];
     numberAnimationsToDraw_ = 0;
     numberAnimationSets_ = numberAnimations_ / numberActionLevels_;
     highActionLevel_ = actionLevels_.IndexOf(highActionLevel) * numberAnimationSets_;
     lowActionLevel_ = actionLevels_.IndexOf(lowActionLevel) * numberAnimationSets_;
 }
 public void setCharacter(CharacterAbstract character)
 {
     character_ = character;
 }
Пример #22
0
 public Shotgun(List<DrawableObjectAbstract> pipeline, CharacterAbstract character, Vector2 gunHandle)
     : base(pipeline, character, TextureMap.fetchTexture(WEAPON_TEXTURE_NAME), gunHandle, AMMO_TYPE, CLIP_SIZE)
 {
     SOUND_RADIUS = SHOTGUN_SOUND_RADIUS;
     CurrentAmmo_ = CLIP_SIZE;
 }
Пример #23
0
 internal override bool initialize()
 {
     enemy_ = (handle_ as CharacterAbstract);
     return (enemy_ != null);
 }
Пример #24
0
 void Start()
 {
     enemy  = GetComponent <CharacterAbstract>();
     source = GetComponent <AudioSource>();
 }
Пример #25
0
 public void setCharacter(CharacterAbstract character)
 {
 }
Пример #26
0
 void Start()
 {
     myTransform = GetComponent <Rigidbody2D>();
     syncPos     = GetComponent <Transform>().position;
     character   = GetComponent <Player>();
 }
Пример #27
0
        internal override bool isValid(List<AI> teamMembers)
        {
            if (teamMembers.Count < 2)
            {
                return false;
            }

            // Create a map of how many agents have each target as their best
            // See if any target has at least half of the team members after him
            Dictionary<Object, int> targetMap = new Dictionary<object, int>();
            Object mutualTarget = null;
            for (int i = 0; i < teamMembers.Count; i++)
            {
                Belief bestTarget = teamMembers[i].Memory_.getFirstBelief(BeliefType.BestTarget);
                if (bestTarget == null)
                {
                    continue;
                }

                if (targetMap.ContainsKey(bestTarget.handle_))
                {
                    targetMap[bestTarget.handle_] = targetMap[bestTarget.handle_] + 1;

                    // We're looking for a target with at least half of the team members
                    //  gunning for him
                    if (targetMap[bestTarget.handle_] >= teamMembers.Count / 2f)
                    {
                        mutualTarget = bestTarget.handle_;
                        break;
                    }
                }
                else
                {
                    targetMap.Add(bestTarget.handle_, 1);
                }
            }

            if (mutualTarget == null)
            {
                return false;
            }

            target_ = (CharacterAbstract)mutualTarget;
            return true;
        }
Пример #28
0
 public DroneGun(List<DrawableObjectAbstract> pipeline, CharacterAbstract character, Vector2 gunHandle)
     : base(pipeline, character, TextureMap.fetchTexture("Pistol"), gunHandle, AMMO_TYPE, CLIP_SIZE)
 {
     this.CurrentAmmo_ = CLIP_SIZE;
 }
Пример #29
0
 internal SystemAiming(AI ai, CharacterAbstract enemy)
     : base(ai)
 {
     enemy_ = enemy;
 }
Пример #30
0
 public bool tryToPickUp(CharacterAbstract character, CollisionDetectorInterface detector)
 {
     float radDist = CommonFunctions.distance(character.getPosition(), position_);
     if (!hasBeenPickedUp_ && detector.checkCollision(character.getBounds(HeightEnum.LOW), bounds_, radDist, Vector2.Zero) != Vector2.Zero)
     {
         handleCollision(character);
         return true;
     }
     return true;
 }