public ThrowGrenadeAction(CharacterAbstract character, AnimationInterface[] animation, Vector2 throwOffset, string actionLevel) : this(character, animation, throwOffset, actionLevel, 0, 0) { }
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; }
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; }
public DummyEnemy(List<DrawableObjectAbstract> pipeline, Vector2 pos) : base(pipeline, new CharacterHealth(), new CharacterAmmo(), new CharacterWeapon(), "dummy", null, null, FRAMELENGTHMODIFIER, Vector2.Zero, pos, new Vector2(1.0f, 0.0f), 0.49f) { AI_ = new DummyAI(this); List<GameTexture> animationTextures = new List<GameTexture>(); animationTextures.Add(TextureMap.getInstance().getTexture("basic_enemy_walk")); animations_ = new AnimationSet(animationTextures); movingToward_ = new Vector2(150.0f, 260.0f); lookingAt_ = new Vector2(250.0f, 60.0f); atLocation_ = false; collisionDetector_ = null; radius_ = RADIUS; Allegiance_ = 2; height_ = new Height(true, false); boundsPolygon_ = new CircularConvexPolygon(radius_, position_); AnimationInterface run = new LoopAnimation(TextureMap.getInstance().getTexture("basic_enemy_walk"), frameLengthModifier_, depth_, boundsPolygon_); AnimationInterface runTo = new LoopAnimation(TextureMap.getInstance().getTexture("basic_enemy_walk"), frameLengthModifier_, depth_, boundsPolygon_); AnimationInterface rest = new LoopAnimation(TextureMap.getInstance().getTexture("GreenPlayer_Blank"), frameLengthModifier_, depth_, boundsPolygon_); AnimationInterface rest2 = new LoopAnimation(TextureMap.getInstance().getTexture("basic_enemy_walk"), frameLengthModifier_, depth_, boundsPolygon_); AnimationInterface[] restAnims = new AnimationInterface[2]; restAnims[0] = rest; restAnims[1] = rest2; AnimationInterface[] shoot = new AnimationInterface[1]; shoot[0] = rest; List<string> levels = new List<string>(); levels.Add("look"); levels.Add("lower"); Dictionary<string, Dictionary<string, CharacterActionInterface>> actions = new Dictionary<string, Dictionary<string, CharacterActionInterface>>(); actions.Add("default", new Dictionary<string, CharacterActionInterface>()); actions["default"].Add("move", new CharacterRunAction(this, run, 2.0f, "lower")); actions["default"].Add("moveTo", new CharacterRunToAction(this, runTo, 2.0f, "lower")); actions["default"].Add("rest", new CharacterStayStillAction(this, restAnims, levels, "lower", "lower")); actions["default"].Add("crouch", new NoAction("lower")); actions["default"].Add("cover", new NoAction("lower")); actions["default"].Add("shoot", new CharacterShootAction(this, shoot, "lower", 0)); actions["default"].Add("look", new CharacterLookAction(this, "look")); actions["default"].Add("lookAt", new CharacterLookAtAction(this, "look")); actions["default"].Add("reload", new NoAction("lower")); actions["default"].Add("throw", new NoAction("lower")); actuator_ = new MultiLevelActuator(actions, levels, this, "default", "rest", "lower", "lower"); currentDrawColor_ = Color.White; health_.update(15); Weapon_ = new DroneGun(pipeline_, this, new Vector2(GUNHANDLEX, GUNHANDLEY)); }
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; }
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 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; }
IEnumerator Start() { if (I_AM_ALEJANDRO) { agent_ = GetComponent("FootstepPlanningTest") as AnimationInterface; } else { agent_ = GetComponent("AgentBrain") as AnimationInterface; } //agent_.autoTraverseOffMeshLink = false; AnimationSetup(); while (Application.isPlaying) { yield return(StartCoroutine(locoState_)); } }
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 ActuatedMainPlayer(List<DrawableObjectAbstract> pipeline, CollisionDetectorInterface detector, Vector2 position, Vector2 direction) : base(pipeline, new CharacterHealth(), new CharacterAmmo(), new CharacterWeapon(), "Woger Ru", detector, null, 8.0f, Vector2.Zero, position, direction, 0.5f) { /* boundsPolygonHigh_ = new ConvexPolygon(BOUNDSPOINTSHIGH, Vector2.Zero); boundsPolygonHigh_.rotate(direction_, position_); boundsPolygonLow_ = new ConvexPolygon(BOUNDSPOINTSLOW, Vector2.Zero); boundsPolygonLow_.rotate(direction_, position_); boundsPolygonLowCrouch_ = new ConvexPolygon(BOUNDSPOINTSLOWCROUCH, Vector2.Zero); boundsPolygonLowCrouch_.rotate(direction_, position_); */ Allegiance_ = 1; List<string> levels = new List<string>(); levels.Add("transition"); levels.Add("turning"); levels.Add("lower"); levels.Add("upper"); List<Vector2> boundsPointsLow = BOUNDSPOINTSLOW; List<Vector2> boundsPointsHigh = BOUNDSPOINTSHIGH; AnimationInterface[] restAnimations = new AnimationInterface[8]; restAnimations[0] = new LoopAnimation(TextureMap.fetchTexture("GreenPlayer_Blank"), frameLengthModifier_, depth_ - 0.02f, boundsPointsLow); restAnimations[1] = restAnimations[0]; restAnimations[2] = restAnimations[0]; restAnimations[3] = restAnimations[0]; restAnimations[4] = new LoopAnimation(TextureMap.fetchTexture("GreenPlayer_Walk_Stand"), frameLengthModifier_, depth_ - 0.01f, boundsPointsLow); restAnimations[5] = restAnimations[4]; restAnimations[6] = new LoopAnimation(TextureMap.fetchTexture("GreenPlayer_UpperBody_Pistol_Stand"), frameLengthModifier_, depth_, boundsPointsHigh); restAnimations[7] = new LoopAnimation(TextureMap.fetchTexture("GreenPlayer_UpperBody_Rifle_Stand"), frameLengthModifier_, depth_, boundsPointsHigh); AnimationInterface[] crouchRestAnimations = new AnimationInterface[8]; crouchRestAnimations[0] = new LoopAnimation(TextureMap.fetchTexture("GreenPlayer_Blank"), frameLengthModifier_, depth_ - 0.02f, BOUNDSPOINTSLOWCROUCH); crouchRestAnimations[1] = crouchRestAnimations[0]; crouchRestAnimations[2] = crouchRestAnimations[0]; crouchRestAnimations[3] = crouchRestAnimations[0]; crouchRestAnimations[4] = new LoopAnimation(TextureMap.fetchTexture("GreenPlayer_Crouch_Stationary"), frameLengthModifier_, depth_ - 0.01f, BOUNDSPOINTSLOWCROUCH); crouchRestAnimations[5] = crouchRestAnimations[4]; crouchRestAnimations[6] = new LoopAnimation(TextureMap.fetchTexture("GreenPlayer_Pistol_Crouch"), frameLengthModifier_, depth_, BOUNDSPOINTSLOWCROUCH); crouchRestAnimations[7] = new LoopAnimation(TextureMap.fetchTexture("GreenPlayer_Rifle_Crouch"), frameLengthModifier_, depth_, BOUNDSPOINTSLOWCROUCH); AnimationInterface runAnimation = new LoopAnimation(TextureMap.fetchTexture("GreenPlayer_Walk_Stand"), frameLengthModifier_, depth_ - 0.01f, boundsPointsLow); AnimationInterface runToAnimation = new LoopAnimation(TextureMap.fetchTexture("GreenPlayer_Walk_Stand"), frameLengthModifier_, depth_ - 0.01f, boundsPointsLow); AnimationInterface coverAnimation = new LoopAnimation(TextureMap.fetchTexture("GreenPlayer_Walk_Stand"), frameLengthModifier_, depth_ - 0.01f, boundsPointsLow); AnimationInterface crouchAnimation = new LoopAnimation(TextureMap.fetchTexture("GreenPlayer_Walk_Stand"), frameLengthModifier_, depth_ - 0.01f, boundsPointsLow); AnimationInterface crouchedRunAnimation = new LoopAnimation(TextureMap.fetchTexture("GreenPlayer_Walk_Crouch"), frameLengthModifier_, depth_ - 0.01f, BOUNDSPOINTSLOWCROUCH); AnimationInterface crouchedRunToAnimation = new LoopAnimation(TextureMap.fetchTexture("GreenPlayer_Walk_Crouch"), frameLengthModifier_, depth_ - 0.01f, BOUNDSPOINTSLOWCROUCH); AnimationInterface crouchedCoverAnimation = new LoopAnimation(TextureMap.fetchTexture("GreenPlayer_Walk_Crouch"), frameLengthModifier_, depth_ - 0.01f, BOUNDSPOINTSLOWCROUCH); AnimationInterface crouchedCrouchAnimation = new LoopAnimation(TextureMap.fetchTexture("GreenPlayer_Walk_Crouch"), frameLengthModifier_, depth_ - 0.01f, BOUNDSPOINTSLOWCROUCH); AnimationInterface[] shootAnimations = new AnimationInterface[2]; shootAnimations[0] = new NonLoopAnimation(TextureMap.fetchTexture("GreenPlayer_UpperBody_Pistol_Stand"), frameLengthModifier_, depth_, boundsPointsHigh); shootAnimations[1] = new NonLoopAnimation(TextureMap.fetchTexture("GreenPlayer_UpperBody_Rifle_Stand"), frameLengthModifier_, depth_, boundsPointsHigh); AnimationInterface[] throwGrenadeAnimations = new AnimationInterface[2]; throwGrenadeAnimations[0] = new NonLoopAnimation(TextureMap.fetchTexture("GreenPlayer_Throw_Stand_Pistol"), frameLengthModifier_, depth_, boundsPointsHigh); throwGrenadeAnimations[1] = new NonLoopAnimation(TextureMap.fetchTexture("GreenPlayer_Throw_Stand_Rifle"), frameLengthModifier_, depth_, boundsPointsHigh); AnimationInterface[] reloadAnimations = new AnimationInterface[2]; reloadAnimations[0] = new NonLoopAnimation(TextureMap.fetchTexture("GreenPlayer_Reload_Stand_Pistol"), frameLengthModifier_, depth_, boundsPointsHigh); reloadAnimations[1] = new NonLoopAnimation(TextureMap.fetchTexture("GreenPlayer_Reload_Stand_Rifle"), frameLengthModifier_, depth_, boundsPointsHigh); AnimationInterface[] crouchedShootAnimations = new AnimationInterface[2]; crouchedShootAnimations[0] = new NonLoopAnimation(TextureMap.fetchTexture("GreenPlayer_Pistol_Crouch"), frameLengthModifier_, depth_, boundsPointsHigh); crouchedShootAnimations[1] = new NonLoopAnimation(TextureMap.fetchTexture("GreenPlayer_Rifle_Crouch"), frameLengthModifier_, depth_, boundsPointsHigh); AnimationInterface[] crouchedThrowGrenadeAnimations = new AnimationInterface[2]; crouchedThrowGrenadeAnimations[0] = new NonLoopAnimation(TextureMap.fetchTexture("GreenPlayer_Throw_Crouch_Pistol"), frameLengthModifier_, depth_, boundsPointsHigh); crouchedThrowGrenadeAnimations[1] = new NonLoopAnimation(TextureMap.fetchTexture("GreenPlayer_Throw_Crouch_Rifle"), frameLengthModifier_, depth_, boundsPointsHigh); AnimationInterface[] crouchedReloadAnimations = new AnimationInterface[2]; crouchedReloadAnimations[0] = new NonLoopAnimation(TextureMap.fetchTexture("GreenPlayer_Reload_Crouch_Pistol"), frameLengthModifier_, depth_, boundsPointsHigh); crouchedReloadAnimations[1] = new NonLoopAnimation(TextureMap.fetchTexture("GreenPlayer_Reload_Crouch_Rifle"), frameLengthModifier_, depth_, boundsPointsHigh); /* AnimationInterface run = new LoopAnimation(TextureMap.getInstance().getTexture("GreenPlayer_Walk_Stand"), frameLengthModifier_, depth_); AnimationInterface runTo = new LoopAnimation(TextureMap.getInstance().getTexture("GreenPlayer_Walk_Stand"), frameLengthModifier_, depth_); AnimationInterface rest = new LoopAnimation(TextureMap.getInstance().getTexture("GreenPlayer_Walk_Stand"), frameLengthModifier_, depth_); AnimationInterface crouch = new LoopAnimation(TextureMap.getInstance().getTexture("GreenPlayer_Stand_Rifle_Walk"), frameLengthModifier_, depth_); AnimationInterface cover = new LoopAnimation(TextureMap.getInstance().getTexture("GreenPlayer_Stand_Rifle_Walk"), frameLengthModifier_, depth_); AnimationInterface crouch_run = new LoopAnimation(TextureMap.getInstance().getTexture("GreenPlayer_Crouch_Rifle_Walk"), frameLengthModifier_, depth_); AnimationInterface crouch_runTo = new LoopAnimation(TextureMap.getInstance().getTexture("GreenPlayer_Crouch_Rifle_Walk"), frameLengthModifier_, depth_); AnimationInterface crouch_rest = new LoopAnimation(TextureMap.getInstance().getTexture("GreenPlayer_Crouch_Rifle"), frameLengthModifier_, depth_); AnimationInterface crouch_crouch = new LoopAnimation(TextureMap.getInstance().getTexture("GreenPlayer_Crouch_Rifle"), frameLengthModifier_, depth_); AnimationInterface crouch_cover = new LoopAnimation(TextureMap.getInstance().getTexture("GreenPlayer_Crouch_Rifle_Walk"), frameLengthModifier_, depth_); AnimationInterface cover_run = new LoopAnimation(TextureMap.getInstance().getTexture("GreenPlayer_Crouch_Rifle_Walk"), frameLengthModifier_, depth_); AnimationInterface cover_runTo = new LoopAnimation(TextureMap.getInstance().getTexture("GreenPlayer_Crouch_Rifle_Walk"), frameLengthModifier_, depth_); AnimationInterface cover_rest = new LoopAnimation(TextureMap.getInstance().getTexture("GreenPlayer_Crouch_Rifle"), frameLengthModifier_, depth_); AnimationInterface cover_crouch = new LoopAnimation(TextureMap.getInstance().getTexture("GreenPlayer_Crouch_Rifle"), frameLengthModifier_, depth_); AnimationInterface cover_cover = new LoopAnimation(TextureMap.getInstance().getTexture("GreenPlayer_Crouch_Rifle_Walk"), frameLengthModifier_, depth_); AnimationInterface cover_shoot = new NonLoopAnimation(TextureMap.fetchTexture("GreenPlayer_StandToShoot_Rifle"), 1.0f, depth_); */ Dictionary<string, Dictionary<string, CharacterActionInterface>> actions = new Dictionary<string, Dictionary<string, CharacterActionInterface>>(); //actions.Add("default", new Dictionary<string, CharacterActionInterface>()); //actions["default"].Add("move", new CharacterRunAction(this, run, 3.0f)); //actions["default"].Add("moveTo", new CharacterRunToAction(this, runTo, 3.0f)); //actions["default"].Add("rest", new CharacterStayStillAction(this, rest)); actions.Add("crouch", new Dictionary<string, CharacterActionInterface>()); actions["crouch"].Add("move", new CharacterRunAction(this, crouchedRunAnimation, SPEED, "lower")); actions["crouch"].Add("moveTo", new CharacterRunToAction(this, crouchedRunToAnimation, SPEED, "lower")); actions["crouch"].Add("rest", new CharacterStayStillAction(this, crouchRestAnimations, levels, "upper", "lower")); actions["crouch"].Add("crouch", new CrouchAction(this, crouchedCrouchAnimation, "stand", new Height(true, true), "transition")); actions["crouch"].Add("cover", new AttachToCoverAction(this, crouchedCoverAnimation, "cover", new Height(true, false), SPEED, "lower")); actions["crouch"].Add("shoot", new CharacterShootAction(this, crouchedShootAnimations, "upper", 0)); actions["crouch"].Add("throw", new ThrowGrenadeAction(this, crouchedThrowGrenadeAnimations, new Vector2(40.5f, 7.5f), "upper", 4, 10)); actions["crouch"].Add("look", new CharacterLookAction(this, "turning")); actions["crouch"].Add("lookAt", new CharacterLookAtAction(this, "turning")); actions["crouch"].Add("reload", new CharacterReloadAction(this, crouchedReloadAnimations, "upper")); actions.Add("stand", new Dictionary<string, CharacterActionInterface>()); actions["stand"].Add("move", new CharacterRunAction(this, runAnimation, SPEED, "lower")); actions["stand"].Add("moveTo", new CharacterRunToAction(this, runToAnimation, SPEED, "lower")); actions["stand"].Add("rest", new CharacterStayStillAction(this, restAnimations, levels, "upper", "lower")); actions["stand"].Add("crouch", new CrouchAction(this, crouchAnimation, "crouch", new Height(true, false), "transition")); actions["stand"].Add("cover", new AttachToCoverAction(this, coverAnimation, "cover", new Height(true, false), SPEED, "lower")); actions["stand"].Add("shoot", new CharacterShootAction(this, shootAnimations, "upper", 0)); actions["stand"].Add("throw", new ThrowGrenadeAction(this, throwGrenadeAnimations, new Vector2(30.5f, 7.5f), "upper", 4, 10)); actions["stand"].Add("look", new CharacterLookAction(this, "turning")); actions["stand"].Add("lookAt", new CharacterLookAtAction(this, "turning")); actions["stand"].Add("reload", new CharacterReloadAction(this, reloadAnimations, "upper")); actions.Add("cover", new Dictionary<string, CharacterActionInterface>()); actions["cover"].Add("move", new CharacterCoverMoveAction(this, crouchedRunAnimation, SPEED, "lower")); actions["cover"].Add("moveTo", new CharacterCoverMoveToAction(this, crouchedRunToAnimation, SPEED, "lower")); actions["cover"].Add("rest", new CharacterStayStillAction(this, crouchRestAnimations, levels, "upper", "lower")); actions["cover"].Add("crouch", new CrouchAction(this, crouchedCrouchAnimation, "stand", new Height(true, true), "transition")); actions["cover"].Add("cover", new DetachFromCoverAction(this, crouchedCoverAnimation, "stand", new Height(true, true), SPEED, "lower")); actions["cover"].Add("shoot", new CharacterCoverShootAction(this, crouchedShootAnimations, 0, "upper")); actions["cover"].Add("throw", new ThrowGrenadeAction(this, crouchedThrowGrenadeAnimations, new Vector2(40.5f, 7.5f), "upper", 4, 10)); actions["cover"].Add("look", new CharacterLookAction(this, "turning")); actions["cover"].Add("lookAt", new CharacterLookAtAction(this, "turning")); actions["cover"].Add("reload", new CharacterReloadAction(this, crouchedReloadAnimations, "upper")); actuator_ = new MultiLevelActuator(actions, levels, this, "stand", "rest", "lower", "upper"); List<GameTexture> anims = new List<GameTexture>(); anims.Add(TextureMap.getInstance().getTexture("PlayerWalk")); animations_ = new AnimationSet(anims); if (RADIUS < RADIUSCROUCH) { radius_ = RADIUSCROUCH; } else { radius_ = RADIUS; }; //collisionDetector_ = new SeparatingAxisCollisionDetector(); collisionDetector_ = detector; if (collisionDetector_ != null) { collisionDetector_.register(this); } // Give the player his currently active weapon Weapon_ = new Pistol(pipeline, this, new Vector2(60f - 37.5f, 33.5f - 37.5f)); //Weapon_.update(); //Weapon_ = new Pistol(pipeline, this, new Vector2(60f - 37.5f, 33.5f - 37.5f)); // Add the other weapons to the character's inventory //Inventory_.Weapons_.Enqueue(new MachineGun(pipeline, this, new Vector2(42f - 37.5f, 47f - 37.5f))); //Inventory_.Weapons_.Enqueue(new Shotgun(pipeline, this, new Vector2(42f - 37.5f, 47f - 37.5f))); height_ = new Height(true, true); }
private static AnimationInterface WizardAnimationPopupLegacy(string _title, ICECreatureControl _control, AnimationInterface _animation_data) { Animation m_animation = _control.GetComponentInChildren <Animation>(); if (m_animation != null && m_animation.enabled == true) { if (EditorApplication.isPlaying) { EditorGUILayout.LabelField("Name", _animation_data.Name); } else { _animation_data.Name = AnimationEditor.AnimationPopupBase(m_animation, _animation_data.Name, _title); AnimationState _state = AnimationTools.GetAnimationStateByName(_control.gameObject, _animation_data.Name); if (_state != null) { if (_state.clip != null) { _state.clip.legacy = true; } if (_animation_data.Name != _state.name) { _animation_data.Name = _state.name; _animation_data.Length = _state.length; _animation_data.Speed = _state.speed; _animation_data.TransitionDuration = 0.25f; _animation_data.wrapMode = _state.wrapMode; _animation_data.Length = _state.length; _animation_data.DefaultSpeed = _state.speed; _animation_data.DefaultWrapMode = _state.wrapMode; } } } } else { EditorGUILayout.HelpBox("Check your Animation Component", MessageType.Warning); } return(_animation_data); }
private static AnimationInterface DrawBehaviourAnimationAnimationData(ICEWorldBehaviour _control, AnimationInterface _animation_data) { Animation _animation = _control.GetComponentInChildren <Animation>(); if (_animation != null && _animation.enabled == true) { Info.Help(Info.ANIMATION_ANIMATION); if (EditorApplication.isPlaying) { EditorGUILayout.LabelField("Name", _animation_data.Name); } else { string _animation_name = AnimationPopup(_animation, _animation_data.Name, "Animation (" + _animation_data.Length.ToString() + " secs.)", Info.ANIMATION_NAME); if (_animation_name != _animation_data.Name) { AnimationState _state = AnimationTools.GetAnimationStateByName(_control.gameObject, _animation_name); if (_state != null) { if (_state.clip != null) { _state.clip.legacy = true; } _animation_data.TransitionDuration = 0.25f; _animation_data.wrapMode = _state.wrapMode; _animation_data.DefaultWrapMode = _state.wrapMode; _animation_data.Speed = _state.speed; _animation_data.DefaultSpeed = _state.speed; _animation_data.Name = _state.name; _animation_data.Length = _state.length; } } } EditorGUI.indentLevel++; _animation_data.wrapMode = DrawBehaviourAnimationWrapMode(_animation_data.wrapMode); DrawBehaviourAnimationData(ref _animation_data.Speed, ref _animation_data.AutoSpeed, ref _animation_data.TransitionDuration, ref _animation_data.AutoTransitionDuration, _animation_data.DefaultSpeed); if (_animation_data.AutoTransitionDuration) { _animation_data.TransitionDuration = _animation_data.Length / 3; } EditorGUI.indentLevel--; } else { EditorGUILayout.HelpBox("Check your Animation Component", MessageType.Warning); } return(_animation_data); }
IEnumerator Start() { if ( I_AM_ALEJANDRO) agent_ = GetComponent("FootstepPlanningTest") as AnimationInterface; else agent_ = GetComponent("AgentBrain") as AnimationInterface; //agent_.autoTraverseOffMeshLink = false; AnimationSetup(); while(Application.isPlaying) { yield return StartCoroutine(locoState_); } }
public HumanEnemy(List<DrawableObjectAbstract> pipeline, Vector2 pos) : base(pipeline, new CharacterHealth(), new CharacterAmmo(), new CharacterWeapon(), "human", null, null, 8.0f, Vector2.Zero, pos, new Vector2(1.0f, 0.0f), Constants.DEPTH_HIGH) { AI_ = new HumanAI(this); boundsPolygonLow_ = new ConvexPolygon(BOUNDSPOINTSLOW, Vector2.Zero); boundsPolygonHigh_ = new ConvexPolygon(BOUNDSPOINTSHIGH, Vector2.Zero); boundsPolygonHigh_.rotate(direction_, position_); boundsPolygonLow_.rotate(direction_, position_); radius_ = RADIUS; Allegiance_ = 2; /* AnimationInterface run = new LoopAnimation(TextureMap.getInstance().getTexture("GreenPlayer_Stand_Rifle_Walk"), frameLengthModifier_, depth_); AnimationInterface runTo = new LoopAnimation(TextureMap.getInstance().getTexture("GreenPlayer_Stand_Rifle_Walk"), frameLengthModifier_, depth_); AnimationInterface rest = new LoopAnimation(TextureMap.getInstance().getTexture("GreenPlayer_Stand_Rifle_Walk"), frameLengthModifier_, depth_); AnimationInterface crouch = new LoopAnimation(TextureMap.getInstance().getTexture("GreenPlayer_Stand_Rifle_Walk"), frameLengthModifier_, depth_); AnimationInterface cover = new LoopAnimation(TextureMap.getInstance().getTexture("GreenPlayer_Stand_Rifle_Walk"), frameLengthModifier_, depth_); AnimationInterface crouch_run = new LoopAnimation(TextureMap.getInstance().getTexture("GreenPlayer_Crouch_Rifle_Walk"), frameLengthModifier_, depth_); AnimationInterface crouch_runTo = new LoopAnimation(TextureMap.getInstance().getTexture("GreenPlayer_Crouch_Rifle_Walk"), frameLengthModifier_, depth_); AnimationInterface crouch_rest = new LoopAnimation(TextureMap.getInstance().getTexture("GreenPlayer_Crouch_Rifle"), frameLengthModifier_, depth_); AnimationInterface crouch_crouch = new LoopAnimation(TextureMap.getInstance().getTexture("GreenPlayer_Crouch_Rifle"), frameLengthModifier_, depth_); AnimationInterface crouch_cover = new LoopAnimation(TextureMap.getInstance().getTexture("GreenPlayer_Crouch_Rifle_Walk"), frameLengthModifier_, depth_); AnimationInterface cover_run = new LoopAnimation(TextureMap.getInstance().getTexture("GreenPlayer_Crouch_Rifle_Walk"), frameLengthModifier_, depth_); AnimationInterface cover_runTo = new LoopAnimation(TextureMap.getInstance().getTexture("GreenPlayer_Crouch_Rifle_Walk"), frameLengthModifier_, depth_); AnimationInterface cover_rest = new LoopAnimation(TextureMap.getInstance().getTexture("GreenPlayer_Crouch_Rifle"), frameLengthModifier_, depth_); AnimationInterface cover_crouch = new LoopAnimation(TextureMap.getInstance().getTexture("GreenPlayer_Crouch_Rifle"), frameLengthModifier_, depth_); AnimationInterface cover_cover = new LoopAnimation(TextureMap.getInstance().getTexture("GreenPlayer_Crouch_Rifle_Walk"), frameLengthModifier_, depth_); AnimationInterface cover_shoot = new NonLoopAnimation(TextureMap.fetchTexture("GreenPlayer_StandToShoot_Rifle"), 1.0f, depth_); AnimationInterface pistol_run = new LoopAnimation(TextureMap.getInstance().getTexture("GreenPlayer_Stand_Pistol_Walk"), frameLengthModifier_, depth_); AnimationInterface pistol_runTo = new LoopAnimation(TextureMap.getInstance().getTexture("GreenPlayer_Stand_Pistol_Walk"), frameLengthModifier_, depth_); AnimationInterface pistol_rest = new LoopAnimation(TextureMap.getInstance().getTexture("GreenPlayer_Stand_Pistol_Walk"), frameLengthModifier_, depth_); AnimationInterface pistol_crouch = new LoopAnimation(TextureMap.getInstance().getTexture("GreenPlayer_Stand_Pistol_Walk"), frameLengthModifier_, depth_); AnimationInterface pistol_cover = new LoopAnimation(TextureMap.getInstance().getTexture("GreenPlayer_Stand_Pistol_Walk"), frameLengthModifier_, depth_); AnimationInterface pistol_crouch_run = new LoopAnimation(TextureMap.getInstance().getTexture("GreenPlayer_Crouch_Pistol_Walk"), frameLengthModifier_, depth_); AnimationInterface pistol_crouch_runTo = new LoopAnimation(TextureMap.getInstance().getTexture("GreenPlayer_Crouch_Pistol_Walk"), frameLengthModifier_, depth_); AnimationInterface pistol_crouch_rest = new LoopAnimation(TextureMap.getInstance().getTexture("GreenPlayer_Crouch_Pistol"), frameLengthModifier_, depth_); AnimationInterface pistol_crouch_crouch = new LoopAnimation(TextureMap.getInstance().getTexture("GreenPlayer_Crouch_Pistol"), frameLengthModifier_, depth_); AnimationInterface pistol_crouch_cover = new LoopAnimation(TextureMap.getInstance().getTexture("GreenPlayer_Crouch_Pistol_Walk"), frameLengthModifier_, depth_); AnimationInterface pistol_cover_run = new LoopAnimation(TextureMap.getInstance().getTexture("GreenPlayer_Crouch_Pistol_Walk"), frameLengthModifier_, depth_); AnimationInterface pistol_cover_runTo = new LoopAnimation(TextureMap.getInstance().getTexture("GreenPlayer_Crouch_Pistol_Walk"), frameLengthModifier_, depth_); AnimationInterface pistol_cover_rest = new LoopAnimation(TextureMap.getInstance().getTexture("GreenPlayer_Crouch_Pistol"), frameLengthModifier_, depth_); AnimationInterface pistol_cover_crouch = new LoopAnimation(TextureMap.getInstance().getTexture("GreenPlayer_Crouch_Pistol"), frameLengthModifier_, depth_); AnimationInterface pistol_cover_cover = new LoopAnimation(TextureMap.getInstance().getTexture("GreenPlayer_Crouch_Pistol_Walk"), frameLengthModifier_, depth_); AnimationInterface pistol_cover_shoot = new NonLoopAnimation(TextureMap.fetchTexture("GreenPlayer_StandToShoot_Pistol"), 1.0f, depth_); Dictionary<string, Dictionary<string, CharacterActionInterface>> actions = new Dictionary<string, Dictionary<string, CharacterActionInterface>>(); //actions.Add("default", new Dictionary<string, CharacterActionInterface>()); //actions["default"].Add("move", new CharacterRunAction(this, run, 3.0f)); //actions["default"].Add("moveTo", new CharacterRunToAction(this, runTo, 3.0f)); //actions["default"].Add("rest", new CharacterStayStillAction(this, rest)); actions.Add("crouch", new Dictionary<string, CharacterActionInterface>()); actions["crouch"].Add("move", new CharacterRunAction(this, crouch_run, SPEED)); actions["crouch"].Add("moveTo", new CharacterRunToAction(this, crouch_runTo, SPEED)); actions["crouch"].Add("rest", new CharacterStayStillAction(this, crouch_rest)); actions["crouch"].Add("crouch", new CrouchAction(this, crouch, "stand", new Height(true, true))); actions["crouch"].Add("cover", new AttachToCoverAction(this, crouch_cover, "cover", new Height(true, false), SPEED)); actions["crouch"].Add("shoot", new CharacterShootAction()); actions["crouch"].Add("throw", new ThrowGrenadeAction(this, crouch_rest, new Vector2(30f, 0f))); actions.Add("stand", new Dictionary<string, CharacterActionInterface>()); actions["stand"].Add("move", new CharacterRunAction(this, run, SPEED)); actions["stand"].Add("moveTo", new CharacterRunToAction(this, runTo, SPEED)); actions["stand"].Add("rest", new CharacterStayStillAction(this, rest)); actions["stand"].Add("crouch", new CrouchAction(this, crouch_crouch, "crouch", new Height(true, false))); actions["stand"].Add("cover", new AttachToCoverAction(this, cover, "cover", new Height(true, false), SPEED)); actions["stand"].Add("shoot", new CharacterShootAction()); actions["stand"].Add("throw", new ThrowGrenadeAction(this, rest, new Vector2(30f, 0f))); actions.Add("cover", new Dictionary<string, CharacterActionInterface>()); actions["cover"].Add("move", new CharacterCoverMoveAction(this, cover_run, SPEED)); actions["cover"].Add("moveTo", new CharacterCoverMoveAction(this, cover_runTo, SPEED)); actions["cover"].Add("rest", new CharacterStayStillAction(this, cover_rest)); actions["cover"].Add("crouch", new CrouchAction(this, cover_crouch, "cover", new Height(true, false))); actions["cover"].Add("cover", new DetachFromCoverAction(this, cover_cover, "stand", new Height(true, true), SPEED)); actions["cover"].Add("shoot", new CharacterCoverShootAction(this, cover_shoot, 1)); actions["cover"].Add("throw", new ThrowGrenadeAction(this, cover_rest, new Vector2(30f, 0f))); actions.Add("pistol_crouch", new Dictionary<string, CharacterActionInterface>()); actions["pistol_crouch"].Add("move", new CharacterRunAction(this, pistol_crouch_run, SPEED)); actions["pistol_crouch"].Add("moveTo", new CharacterRunToAction(this, pistol_crouch_runTo, SPEED)); actions["pistol_crouch"].Add("rest", new CharacterStayStillAction(this, pistol_crouch_rest)); actions["pistol_crouch"].Add("crouch", new CrouchAction(this, pistol_crouch, "pistol_stand", new Height(true, true))); actions["pistol_crouch"].Add("cover", new AttachToCoverAction(this, pistol_crouch_cover, "pistol_cover", new Height(true, false), SPEED)); actions["pistol_crouch"].Add("shoot", new CharacterShootAction()); actions["pistol_crouch"].Add("throw", new ThrowGrenadeAction(this, pistol_crouch_rest, new Vector2(30f, 0f))); actions.Add("pistol_stand", new Dictionary<string, CharacterActionInterface>()); actions["pistol_stand"].Add("move", new CharacterRunAction(this, pistol_run, SPEED)); actions["pistol_stand"].Add("moveTo", new CharacterRunToAction(this, pistol_runTo, SPEED)); actions["pistol_stand"].Add("rest", new CharacterStayStillAction(this, pistol_rest)); actions["pistol_stand"].Add("crouch", new CrouchAction(this, pistol_crouch_crouch, "pistol_crouch", new Height(true, false))); actions["pistol_stand"].Add("cover", new AttachToCoverAction(this, pistol_cover, "pistol_cover", new Height(true, false), SPEED)); actions["pistol_stand"].Add("shoot", new CharacterShootAction()); actions["pistol_stand"].Add("throw", new ThrowGrenadeAction(this, pistol_rest, new Vector2(30f, 0f))); actions.Add("pistol_cover", new Dictionary<string, CharacterActionInterface>()); actions["pistol_cover"].Add("move", new CharacterCoverMoveAction(this, pistol_cover_run, SPEED)); actions["pistol_cover"].Add("moveTo", new CharacterCoverMoveAction(this, pistol_cover_runTo, SPEED)); actions["pistol_cover"].Add("rest", new CharacterStayStillAction(this, pistol_cover_rest)); actions["pistol_cover"].Add("crouch", new CrouchAction(this, pistol_cover_crouch, "pistol_cover", new Height(true, false))); actions["pistol_cover"].Add("cover", new DetachFromCoverAction(this, pistol_cover_cover, "pistol_stand", new Height(true, true), SPEED)); actions["pistol_cover"].Add("shoot", new CharacterCoverShootAction(this, pistol_cover_shoot, 1)); actions["pistol_cover"].Add("throw", new ThrowGrenadeAction(this, pistol_cover_rest, new Vector2(30f, 0f))); actuator_ = new DefaultActuator(actions, this, "pistol_stand"); */ //YOU MUST CHANGE THIS CODE List<string> levels = new List<string>(); levels.Add("transition"); levels.Add("turning"); levels.Add("lower"); levels.Add("upper"); List<Vector2> boundsPointsLow = BOUNDSPOINTSLOW; List<Vector2> boundsPointsHigh = BOUNDSPOINTSHIGH; AnimationInterface[] restAnimations = new AnimationInterface[8]; restAnimations[0] = new LoopAnimation(TextureMap.fetchTexture("GreenPlayer_Blank"), frameLengthModifier_, depth_ - 0.02f, boundsPointsLow); restAnimations[1] = restAnimations[0]; restAnimations[2] = restAnimations[0]; restAnimations[3] = restAnimations[0]; restAnimations[4] = new LoopAnimation(TextureMap.fetchTexture("GreenPlayer_Walk_Stand"), frameLengthModifier_, depth_ - 0.01f, boundsPointsLow); restAnimations[5] = restAnimations[4]; restAnimations[6] = new LoopAnimation(TextureMap.fetchTexture("RedPlayer_Pistol_Stand"), frameLengthModifier_, depth_, boundsPointsHigh); restAnimations[7] = new LoopAnimation(TextureMap.fetchTexture("RedPlayer_Rifle_Stand"), frameLengthModifier_, depth_, boundsPointsHigh); AnimationInterface[] crouchRestAnimations = new AnimationInterface[8]; crouchRestAnimations[0] = new LoopAnimation(TextureMap.fetchTexture("GreenPlayer_Blank"), frameLengthModifier_, depth_ - 0.02f, BOUNDSPOINTSLOWCROUCH); crouchRestAnimations[1] = crouchRestAnimations[0]; crouchRestAnimations[2] = crouchRestAnimations[0]; crouchRestAnimations[3] = crouchRestAnimations[0]; crouchRestAnimations[4] = new LoopAnimation(TextureMap.fetchTexture("GreenPlayer_Crouch_Stationary"), frameLengthModifier_, depth_ - 0.01f, BOUNDSPOINTSLOWCROUCH); crouchRestAnimations[5] = crouchRestAnimations[4]; crouchRestAnimations[6] = new LoopAnimation(TextureMap.fetchTexture("RedPlayer_Pistol_Crouch"), frameLengthModifier_, depth_, BOUNDSPOINTSLOWCROUCH); crouchRestAnimations[7] = new LoopAnimation(TextureMap.fetchTexture("RedPlayer_Rifle_Crouch"), frameLengthModifier_, depth_, BOUNDSPOINTSLOWCROUCH); AnimationInterface runAnimation = new LoopAnimation(TextureMap.fetchTexture("GreenPlayer_Walk_Stand"), frameLengthModifier_, depth_ - 0.01f, boundsPointsLow); AnimationInterface runToAnimation = new LoopAnimation(TextureMap.fetchTexture("GreenPlayer_Walk_Stand"), frameLengthModifier_, depth_ - 0.01f, boundsPointsLow); AnimationInterface coverAnimation = new LoopAnimation(TextureMap.fetchTexture("GreenPlayer_Walk_Stand"), frameLengthModifier_, depth_ - 0.01f, boundsPointsLow); AnimationInterface crouchAnimation = new LoopAnimation(TextureMap.fetchTexture("GreenPlayer_Walk_Stand"), frameLengthModifier_, depth_ - 0.01f, boundsPointsLow); AnimationInterface crouchedRunAnimation = new LoopAnimation(TextureMap.fetchTexture("GreenPlayer_Walk_Crouch"), frameLengthModifier_, depth_ - 0.01f, BOUNDSPOINTSLOWCROUCH); AnimationInterface crouchedRunToAnimation = new LoopAnimation(TextureMap.fetchTexture("GreenPlayer_Walk_Crouch"), frameLengthModifier_, depth_ - 0.01f, BOUNDSPOINTSLOWCROUCH); AnimationInterface crouchedCoverAnimation = new LoopAnimation(TextureMap.fetchTexture("GreenPlayer_Walk_Crouch"), frameLengthModifier_, depth_ - 0.01f, BOUNDSPOINTSLOWCROUCH); AnimationInterface crouchedCrouchAnimation = new LoopAnimation(TextureMap.fetchTexture("GreenPlayer_Walk_Crouch"), frameLengthModifier_, depth_ - 0.01f, BOUNDSPOINTSLOWCROUCH); AnimationInterface[] shootAnimations = new AnimationInterface[2]; shootAnimations[0] = new LoopAnimation(TextureMap.fetchTexture("RedPlayer_Pistol_Stand"), frameLengthModifier_, depth_, boundsPointsHigh); shootAnimations[1] = new LoopAnimation(TextureMap.fetchTexture("RedPlayer_Rifle_Stand"), frameLengthModifier_, depth_, boundsPointsHigh); AnimationInterface[] throwGrenadeAnimations = new AnimationInterface[2]; throwGrenadeAnimations[0] = new LoopAnimation(TextureMap.fetchTexture("RedPlayer_Pistol_Stand"), frameLengthModifier_, depth_, boundsPointsHigh); throwGrenadeAnimations[1] = new LoopAnimation(TextureMap.fetchTexture("RedPlayer_Rifle_Stand"), frameLengthModifier_, depth_, boundsPointsHigh); AnimationInterface[] crouchedShootAnimations = new AnimationInterface[2]; crouchedShootAnimations[0] = new NonLoopAnimation(TextureMap.fetchTexture("RedPlayer_Pistol_Crouch"), frameLengthModifier_, depth_, boundsPointsHigh); crouchedShootAnimations[1] = new NonLoopAnimation(TextureMap.fetchTexture("RedPlayer_Rifle_Crouch"), frameLengthModifier_, depth_, boundsPointsHigh); AnimationInterface[] crouchedThrowGrenadeAnimations = new AnimationInterface[2]; crouchedThrowGrenadeAnimations[0] = new LoopAnimation(TextureMap.fetchTexture("RedPlayer_Pistol_Crouch"), frameLengthModifier_, depth_, boundsPointsHigh); crouchedThrowGrenadeAnimations[1] = new LoopAnimation(TextureMap.fetchTexture("RedPlayer_Rifle_Crouch"), frameLengthModifier_, depth_, boundsPointsHigh); Dictionary<string, Dictionary<string, CharacterActionInterface>> actions = new Dictionary<string, Dictionary<string, CharacterActionInterface>>(); actions.Add("crouch", new Dictionary<string, CharacterActionInterface>()); actions["crouch"].Add("move", new CharacterRunAction(this, crouchedRunAnimation, SPEED, "lower")); actions["crouch"].Add("moveTo", new CharacterRunToAction(this, crouchedRunToAnimation, SPEED, "lower")); actions["crouch"].Add("rest", new CharacterStayStillAction(this, crouchRestAnimations, levels, "upper", "lower")); actions["crouch"].Add("crouch", new CrouchAction(this, crouchedCrouchAnimation, "stand", new Height(true, true), "transition")); actions["crouch"].Add("cover", new AttachToCoverAction(this, crouchedCoverAnimation, "cover", new Height(true, false), SPEED, "lower")); actions["crouch"].Add("shoot", new CharacterShootAction(this, crouchedShootAnimations, "upper", 0)); actions["crouch"].Add("throw", new ThrowGrenadeAction(this, crouchedThrowGrenadeAnimations, new Vector2(30f, 0f), "upper")); actions["crouch"].Add("look", new CharacterLookAction(this, "turning")); actions["crouch"].Add("lookAt", new CharacterLookAtAction(this, "turning")); actions["crouch"].Add("reload", new NoAction("upper")); actions.Add("stand", new Dictionary<string, CharacterActionInterface>()); actions["stand"].Add("move", new CharacterRunAction(this, runAnimation, SPEED, "lower")); actions["stand"].Add("moveTo", new CharacterRunToAction(this, runToAnimation, SPEED, "lower")); actions["stand"].Add("rest", new CharacterStayStillAction(this, restAnimations, levels, "upper", "lower")); actions["stand"].Add("crouch", new CrouchAction(this, crouchAnimation, "crouch", new Height(true, false), "transition")); actions["stand"].Add("cover", new AttachToCoverAction(this, coverAnimation, "cover", new Height(true, false), SPEED, "lower")); actions["stand"].Add("shoot", new CharacterShootAction(this, shootAnimations, "upper", 0)); actions["stand"].Add("throw", new ThrowGrenadeAction(this, throwGrenadeAnimations, new Vector2(30f, 0f), "upper")); actions["stand"].Add("look", new CharacterLookAction(this, "turning")); actions["stand"].Add("lookAt", new CharacterLookAtAction(this, "turning")); actions["stand"].Add("reload", new NoAction("upper")); actions.Add("cover", new Dictionary<string, CharacterActionInterface>()); actions["cover"].Add("move", new CharacterCoverMoveAction(this, crouchedRunAnimation, SPEED, "lower")); actions["cover"].Add("moveTo", new CharacterCoverMoveToAction(this, crouchedRunToAnimation, SPEED, "lower")); actions["cover"].Add("rest", new CharacterStayStillAction(this, crouchRestAnimations, levels, "upper", "lower")); actions["cover"].Add("crouch", new CrouchAction(this, crouchedCrouchAnimation, "stand", new Height(true, true), "transition")); actions["cover"].Add("cover", new DetachFromCoverAction(this, crouchedCoverAnimation, "stand", new Height(true, true), SPEED, "lower")); actions["cover"].Add("shoot", new CharacterCoverShootAction(this, crouchedShootAnimations, 0, "upper")); actions["cover"].Add("throw", new ThrowGrenadeAction(this, crouchedThrowGrenadeAnimations, new Vector2(30f, 0f), "upper")); actions["cover"].Add("look", new CharacterLookAction(this, "turning")); actions["cover"].Add("lookAt", new CharacterLookAtAction(this, "turning")); actions["cover"].Add("reload", new NoAction("upper")); actuator_ = new MultiLevelActuator(actions, levels, this, "stand", "rest", "lower", "upper"); //END CHANGE NEEDED Weapon_ = new Pistol(pipeline, this, new Vector2(60f - 37.5f, 33.5f - 37.5f)); height_ = new Height(true, true); health_.update(25); }