private void Start()
 {
     if (instance is null)
     {
         instance = gameObject.transform.GetComponent <AnimationActions>();
     }
 }
 public AnimatedSprite(Texture2D texture, EntityType entityType, IList<AnimationSequence> animations, AnimationActions initialAnimationAction,
     Rectangle worldPosition, Vector2 speed = new Vector2(), Vector2 direction = new Vector2(), bool isCollidable = false, int collisionOffset = 0)
     : base(texture, entityType, worldPosition, speed: speed, direction: direction, isCollidable: isCollidable, collisionOffset: collisionOffset)
 {
     Animations = animations;
     CurrentAnimation = Animations.First(a => a.AnimationAction == initialAnimationAction);
 }
 public UserControlledSprite(Texture2D texture, EntityType entityType, IList<AnimationSequence> animations, AnimationActions initialAnimationAction,
     Rectangle worldPosition, int moveSpeed, bool isCollidable = false, int collisionOffset = 0)
     : base(texture, entityType, animations, initialAnimationAction, worldPosition, isCollidable: isCollidable,
     collisionOffset: collisionOffset)
 {
     MaxMoveSpeed = moveSpeed;
 }
Beispiel #4
0
 protected new void Awake()
 {
     base.Awake();
     if (agent == null)
     {
         agent = GetComponent <NavMeshAgent>();
     }
     agent.speed = Speed;
     animActions = gameObject.GetComponent <AnimationActions>();
 }
Beispiel #5
0
 protected new void Awake()
 {
     base.Awake();
     animActions = gameObject.GetComponent <AnimationActions>();
     if (shooter == null)
     {
         shooter = GetComponentInChildren <Shooter>();
     }
     if (aimer == null)
     {
         aimer = GetComponentInChildren <EnemyAimer>();
     }
 }
Beispiel #6
0
 // Start is called before the first frame update
 public virtual void Start()
 {
     Cursor.visible = false;
     playerRgd      = GetComponent <Rigidbody2D>();
     anim           = GetComponentInChildren <Animator>();
     playerCollider = GetComponent <BoxCollider2D>();
     circleCollider = GetComponent <CircleCollider2D>();
     redColor.a     = 0;
     animActions    = FindObjectOfType <AnimationActions>();
     Physics2D.IgnoreLayerCollision(9, 10, false);
     if (flip)
     {
         transform.localScale = new Vector3(-1, 1, 1);
     }
 }
 public void SetAnimationAction(AnimationActions animationAction)
 {
     CurrentAnimation = Animations.First(a => a.AnimationAction == animationAction);
 }
 public AnimationSequence(AnimationActions animationAction)
 {
     AnimationAction = animationAction;
 }