Example #1
0
 public MushroomOneUp(Game1 game, float x, float y) : base(new Vector2(x, y), new LVector2(new RectangleLimit(5, 10)), new LVector2(Limit <Vector2> .NONE))
 {
     Bounds              = new Rectangle(0, 0, 1, 1);
     Movement            = new EntityMovement(game);
     Collision           = new ItemCollision();
     mushroomOneUpSprite = ItemSpriteFactory.Instance.CreateMushroomOneUpSprite();
 }
Example #2
0
    // Use this for initialization
    void Start()
    {
        health = maxHealth;

        damageDealerType = "playerWeapon";
        entityMovement   = this.GetComponent <EntityMovement>();
    }
 void OnLandGround(EntityMovement entMove)
 {
     if(mReleased && Mathf.Sign(entMove.accel.x) == Mathf.Sign(entMove.velocity.x)) {
         //Debug.Log("land accel: "+entMove.accel.x);
         entMove.accel.x *= -2; //"brakes"
     }
 }
Example #4
0
        public ActionPatrol(Entity owner, Vector3 targetPosition) : base(owner)
        {
            _startingPosition = owner.transform.position;
            _targetPosition   = targetPosition;

            _entityMovement = entity.GetCharacterComponent <EntityMovement>();
        }
Example #5
0
    /// <summary>
    /// method call when create the class. Getting the entity movement and initializing the keyboardMovement var
    /// </summary>
    protected override void CustomAwake()
    {
        base.CustomAwake();

        _entityMovement   = GetComponentInParent <EntityMovement>();
        _keyboardMovement = new Vector3();
    }
	protected void Awake()
	{
		animator = GetComponent<Animator>();
		entity = GetComponentInParent<Entity>();
		agent = entity.GetComponent<NavMeshAgent>();
		movement = entity.GetComponent<EntityMovement>();
	}
Example #7
0
    // Use this for initialization
    // Starts after everything has woken - must wait for gamecontrol
    void Start()
    {
        Screen.orientation  = ScreenOrientation.LandscapeLeft;
        this.entityMovement = GetComponent <EntityMovement>();
        Camera.main.GetComponent <CameraShake>().enabled = false;
        projectileSpawner         = GetComponent <PlayerProjectileSpawner>();
        meleeCollider.enabled     = false;
        attacking                 = false;
        lastAttack                = Time.time;
        temporaryInvulnerableTime = Time.time;
        rend = this.GetComponentInChildren <SkinnedMeshRenderer>();

        //Setup player sounds
        meleeAttackSound   = Resources.Load("Audio/melee_attack") as AudioClip;
        specialAttackSound = Resources.Load("Audio/special_attack") as AudioClip;
        rangedAttackSound  = Resources.Load("Audio/range_attack") as AudioClip;
        damageTakenSound   = Resources.Load("Audio/player_ugh") as AudioClip;
        jumpSound          = Resources.Load("Audio/player_jump") as AudioClip;

        //Get a component reference to the Player's animator component
        animator = GetComponent <Animator>();

        //Get stats from the GameControl
        strength      = GameControl.control.playerStr;
        agility       = GameControl.control.playerAgl;
        dexterity     = GameControl.control.playerDex;
        intelligence  = GameControl.control.playerInt;
        vitality      = GameControl.control.playerVit;
        abilityPoints = GameControl.control.abilityPoints;
        maxHealth     = vitality;
        currentHealth = maxHealth;
    }
Example #8
0
    void split()
    {
        Destroy(this.otherInput);

        this.otherPlayer.gameObject.SetActive(true);
        this.otherPlayer.transform.position = this.transform.position;
        EntityMovement otherEntitiyMovement = this.otherPlayer.GetComponent <EntityMovement>();

        switch (this.GetComponent <EntityMovement>().direction)
        {
        case EntityMovement.Direction.Up:
            otherEntitiyMovement.changeDirection(EntityMovement.Direction.Down, true);
            break;

        case EntityMovement.Direction.Down:
            otherEntitiyMovement.changeDirection(EntityMovement.Direction.Up, true);
            break;

        case EntityMovement.Direction.Left:
            otherEntitiyMovement.changeDirection(EntityMovement.Direction.Right, true);
            break;

        case EntityMovement.Direction.Right:
            otherEntitiyMovement.changeDirection(EntityMovement.Direction.Left, true);
            break;
        }
        this.otherPlayer.startCooldown();
        this.otherPlayer = null;

        this.isMega = false;
        this.startCooldown();
    }
Example #9
0
 /// <summary>
 /// method call when the state start, setting some initial value for the movement calculation
 /// </summary>
 public override void StateInit()
 {
     // getting the entity movement
     _entityMovement = (StateMachine as FSMEnemyBehavior).Plane.GetComponentInChildren <EntityMovement>();
     // initial position for the plane
     _initialPosition = _entityMovement.transform.position;
     _lastPosition    = _initialPosition;
 }
    /// <summary>
    /// override method call when the class is created.
    /// setting the entity movement var
    /// setting the initial mouse position in the _lastMousePosition var
    /// </summary>
    protected override void CustomAwake()
    {
        base.CustomAwake();

        _entityMovement = GetComponentInParent <EntityMovement>();

        _lastMousePosition = Camera.main.ScreenToWorldPoint(Input.mousePosition);
    }
Example #11
0
 public Mario(Game1 game, int x, int y) : base(new Vector2(x, y), new LVector2(MaxWalkVelocity), new LVector2(MaxAcceleration))
 {
     this.game = game;
     Movement  = new EntityMovement(game);
     Collision = new PlayerCollision();
     State     = new SmallRightIdleState(this);
     Direction = 1;
 }
Example #12
0
    public RayCastController(EntityMovement movement)
    {
        this.movement = movement;
        //rayOrigins = new RaycastOrigins();

        boxCollider = movement.BoxCollider;
        CalculateRaySpacing();
    }
Example #13
0
 public Star(Game1 game, float x, float y) : base(new Vector2(x, y), new LVector2(new RectangleLimit(5, 10)), new LVector2(Limit <Vector2> .NONE))
 {
     this.game  = game;
     Bounds     = new Rectangle(0, 0, 1, 1);
     Movement   = new EntityMovement(game);
     Collision  = new ItemCollision();
     starSprite = ItemSpriteFactory.Instance.CreateStarSprite();
 }
Example #14
0
    private bool ReturnIfRootIsActive(EntityMovement targetRoot, List <EntityMovement> activeRoots)
    {
        if (activeRoots.Contains(targetRoot))
        {
            return(true);
        }

        return(false);
    }
Example #15
0
 public BowserFireball(Game1 game, Vector2 position, int direction) : base(position, new LVector2(maxVelocity), new LVector2(maxAcceleration))
 {
     this.game      = game;
     this.direction = new SimpleForce(direction, 0);
     Movement       = new EntityMovement(game);
     Collision      = new ProjectileCollision();
     fireballSprite = FireballSpriteFactory.Instance.CreateBowserFireSprite();
     Bounds         = new Rectangle(0, 0, 2, 1);
 }
Example #16
0
    //CONSTRUCTOR
    public ES_Wander(GameObject entity, int maxWanderRange, Vector2 moveAroundArea)
    {
        this.entity         = entity;
        this.maxWanderRange = maxWanderRange;
        this.moveAroundArea = moveAroundArea;

        entityMovement = entity.GetComponent <EntityMovement>();
        entityMovement.DestinationReached += HasArrivedAtDestination;
    }
Example #17
0
        public override void _Ready()
        {
            base._Ready();
            entityMovement = GetNode <EntityMovement>(entityMovementNodePath);
            gameState      = NodeGetter.GetFirstNodeInGroup <GameState>(GetTree(), GameConstants.GameStateGroup, true);

            pathfindingTileMap = NodeGetter.GetFirstNodeInGroup <PathfindingTileMap>(GetTree(), GameConstants.PathfindingTileMapGroup, true);
            soundEngineNode    = NodeGetter.GetFirstNodeInGroup <SoundEngineNode>(GetTree(), GameConstants.SoundEngineGroup, true);
        }
Example #18
0
    // Use this for initialization
    void Start()
    {
        Attributes = GetComponent <Attributes>();
        Movement   = GetComponent <EntityMovement>();

        EntityManager = StarSystem.EntityManager;

        CurrentState = new GuardState(this);
    }
Example #19
0
 public Hammer(Game1 game, Vector2 position) :
     base(position, new LVector2(Limit <Vector2> .NONE), new LVector2(Limit <Vector2> .NONE))
 {
     this.game    = game;
     Bounds       = new Rectangle(0, 0, 1, 1);
     Movement     = new EntityMovement(game);
     Collision    = new ItemCollision();
     hammerSprite = ItemSpriteFactory.Instance.CreateHammerSprite();
 }
Example #20
0
 // Start is called before the first frame update
 void Start()
 {
     playerTransform             = GameObject.FindGameObjectWithTag("Player").GetComponent <Transform>();
     healthPickupParentTransform = GameObject.Find("HealthPickupsParent").GetComponent <Transform>();
     hpPickupPrefab  = Resources.Load <GameObject>("Prefabs/HealthPickup");
     entityMovement  = GetComponent <EntityMovement>();
     m_audioSource   = GetComponent <AudioSource>();
     m_enemyHitSound = Resources.Load("Audio/FX/enemy_hit/hitenemy") as AudioClip;
 }
Example #21
0
        public ActionAttackEntity(Entity owner, Entity target, bool onTargetDeathTryAutoAttack) : base(owner)
        {
            _target = target;

            _entityMovement  = entity.GetCharacterComponent <EntityMovement>();
            _entityDetection = entity.GetCharacterComponent <EntityDetection>();
            _entityAttack    = entity.GetCharacterComponent <EntityAttack>();

            _onTargetDeathTryAutoAttack = onTargetDeathTryAutoAttack;
        }
Example #22
0
    public RayCast3DController(EntityMovement movement)
    {
        //Debug.Log("creating 3d ray caster");

        this.movement   = movement;
        capsuleCollider = movement.MyPhysics.MyCapsuelCollider;

        //boxCollider = movement.Box2DCollider;
        CalculateRaySpacing();
    }
Example #23
0
    public RayCastController(EntityMovement movement)
    {
        Debug.Log("creating 2d ray caster");

        this.movement = movement;
        //rayOrigins = new RaycastOrigins();

        boxCollider = movement.MyPhysics.Box2DCollider;
        CalculateRaySpacing();
    }
 void OnDirXChange(EntityMovement entMove)
 {
     if(mReleased) {
         entMove.accel.x = 0;
         entMove.velocity.x = 0;
     }
     else {
         mPlayer.entMove.accel.x = mMoveX*moveAccel*mPlayer.scale;
     }
 }
Example #25
0
 public Koopa(Game1 game, float x, float y) : base(new Vector2(x, y), new LVector2(Limit <Vector2> .NONE), new LVector2(Limit <Vector2> .NONE))
 {
     this.game = game;
     Bounds    = new Rectangle(0, 0, 1, 1);
     Movement  = new EntityMovement(game);
     Collision = new EnemyCollision();
     Speed     = 2;
     State     = new KoopaLeftMovingState(game, this);
     Flip      = false;
 }
Example #26
0
    // Start is called before the first frame update
    private void Start()
    {
        rb2D           = GetComponent <Rigidbody2D>();
        entityMovement = GetComponent <EntityMovement>();
        stateMachine   = FindObjectOfType <StateMachine>();

        seeker = GetComponent <Seeker>();
        seeker.pathCallback += OnPathComplete;
        InvokeRepeating("UpdatePath", 0f, 0.1f);
    }
Example #27
0
    //CONSTRUCTOR
    public ES_Wander(string stateName, GameObject entity, int maxWanderRange)
        :
        base(stateName)
    {
        this.entity         = entity;
        this.maxWanderRange = maxWanderRange;

        entityMovement = entity.GetComponent <EntityMovement>();
        entityMovement.DestinationReachedHandler += HasArrivedAtDestination;
    }
Example #28
0
    // Use this for initialization
    public void Start()
    {
        this.spawnController = FindObjectOfType <EnemySpawnController>();
        this.entityMovement  = GetComponent <EntityMovement>();
        this.animator        = animator = GetComponent <Animator>();
        dieSound             = Resources.Load("Audio/monster_die") as AudioClip;

        boxCollider    = GetComponent <BoxCollider2D>();
        circleCollider = GetComponent <CircleCollider2D>();
    }
Example #29
0
 public LakituBall(Game1 game, Vector2 position, int direction) : base(position, new LVector2(maxVelocity), new LVector2(maxAcceleration))
 {
     this.game        = game;
     this.direction   = new SimpleForce(direction, 0);
     Movement         = new EntityMovement(game);
     Collision        = new LakituProjectileCollision();
     lakituBallSprite = LakituSpriteFactory.Instance.CreateLakituBallSprite();
     Bounds           = new Rectangle(0, 0, 1, 1);
     flip             = false;
     Speed            = direction;
 }
    private void Start()
    {
        startPosition  = GetComponent <Transform>();
        entityMovement = GetComponent <EntityMovement>();

        goalPositionLastUpdate = goalPosition.position;

        // Find our initial path
        _WaitingForPath = true;
        PathFinding.RequestPath(startPosition, goalPosition, UpdatePathData);
    }
Example #31
0
 public Lakitu(Game1 game, float x, float y) : base(new Vector2(x, y), new LVector2(Limit <Vector2> .NONE), new LVector2(Limit <Vector2> .NONE))
 {
     this.game = game;
     Bounds    = new Rectangle(0, 0, 1, 1);
     Movement  = new EntityMovement(game);
     Collision = new LakituCollision();
     MarioDistanceCollision = new LakituCollision();
     Speed = 5;
     Flip  = false;
     Left  = false;
     State = new LakituFloatingState(game, this);
 }
Example #32
0
    // Start is called before the first frame update
    void Start()
    {
        playerTransform             = GameObject.FindGameObjectWithTag("Player").GetComponent <Transform>();
        healthPickupParentTransform = GameObject.Find("HealthPickupsParent").GetComponent <Transform>();
        projectilesParent           = GameObject.Find("ProjectilesParent").GetComponent <Transform>();
        hpPickupPrefab   = Resources.Load <GameObject>("Prefabs/HealthPickup");
        projectilePrefab = Resources.Load <GameObject>("Prefabs/EnemyProjectile");
        entityMovement   = GetComponent <EntityMovement>();
        timePassed       = 0;

        m_rigidbody       = GetComponent <Rigidbody2D>();
        m_audioSource     = GetComponent <AudioSource>();
        m_enemyHitSound   = Resources.Load("Audio/FX/enemy_hit/hitenemy") as AudioClip;
        m_enemyShootSound = Resources.Load("Audio/FX/enemy_shooting/545199__cbj-student__pop-3") as AudioClip;
    }
Example #33
0
 // Start is called before the first frame update
 void Start()
 {
     m_playerTransform             = GameObject.FindGameObjectWithTag("Player").GetComponent <Transform>();
     m_healthPickupParentTransform = GameObject.Find("HealthPickupsParent").GetComponent <Transform>();
     m_killText = GameObject.Find("KillText");
     if (m_killText == null)
     {
         return;
     }
     m_pickUpText     = GameObject.Find("PickUpText");
     m_pickUpPlacer   = m_pickUpText.GetComponent <PlaceOnSceneObject>();
     m_hpPickupPrefab = Resources.Load <GameObject>("Prefabs/HealthPickup");
     m_entityMovement = GetComponent <EntityMovement>();
     m_playerHealth   = GameObject.FindGameObjectWithTag("Player").GetComponent <PlayerHealth>();
     m_audioSource    = GetComponent <AudioSource>();
     m_enemyHitSound  = Resources.Load("Audio/FX/enemy_hit/hitenemy") as AudioClip;
 }
 /*
 [Command]
 public void CmdGetLastServerDestination()
 {
     lastServerDestination = entityMovement.Destination;
 }
 */
 void Awake()
 {
     entityMovement = GetComponent<EntityMovement>();
 }
Example #35
0
 // Use this for initialization
 void Start()
 {
     player = GameObject.FindGameObjectWithTag("Player");
     this.entityMovement = GetComponent<EntityMovement>();
     this.animator = GetComponent<Animator>();
     projectileSpawner = GetComponent<BossProjectileSpawner>();
     yProjectileOffset = -0.2f;
     xProjectileOffset = 3f;
     currentHealth = 10;
     maxHealth = 10;
     healthBar = GameObject.FindGameObjectWithTag("HealthBar");
     healthBarScale = healthBar.transform.localScale;
     chargeSound = Resources.Load("Audio/boss_charge") as AudioClip;
     largeShootSound = Resources.Load("Audio/boss_shoot_large") as AudioClip;
     smallShootSound = Resources.Load("Audio/small_shoot_sound") as AudioClip;
     renderer = this.GetComponentInChildren<SkinnedMeshRenderer>();
     PlayGamesPlatform.Activate();
     Social.localUser.Authenticate((bool success) =>
     {
     });
     generateShield();
 }
Example #36
0
    // Use this for initialization
    // Starts after everything has woken - must wait for gamecontrol
    void Start()
    {
        Screen.orientation = ScreenOrientation.LandscapeLeft;
        this.entityMovement = GetComponent<EntityMovement>();
        Camera.main.GetComponent<CameraShake>().enabled = false;
        projectileSpawner = GetComponent<PlayerProjectileSpawner>();
        meleeCollider.enabled = false;
        attacking = false;
        lastAttack = Time.time;
        temporaryInvulnerableTime = Time.time;
        rend = this.GetComponentInChildren<SkinnedMeshRenderer>();

        //Setup player sounds
        meleeAttackSound = Resources.Load("Audio/melee_attack") as AudioClip;
        specialAttackSound = Resources.Load("Audio/special_attack") as AudioClip;
        rangedAttackSound = Resources.Load("Audio/range_attack") as AudioClip;
        damageTakenSound= Resources.Load("Audio/player_ugh") as AudioClip;
        jumpSound = Resources.Load("Audio/player_jump") as AudioClip;

        //Get a component reference to the Player's animator component
        animator = GetComponent<Animator>();

        //Get stats from the GameControl
        strength = GameControl.control.playerStr;
        agility = GameControl.control.playerAgl;
        dexterity = GameControl.control.playerDex;
        intelligence = GameControl.control.playerInt;
        vitality = GameControl.control.playerVit;
        abilityPoints = GameControl.control.abilityPoints;
        maxHealth = vitality;
        currentHealth = maxHealth;
    }
Example #37
0
 void OnLand(EntityMovement entMove)
 {
     if(mBounceSpeed == 0) {
         Release();
     }
     else {
         entMove.Jump(mBounceSpeed, false);
         mBounceSpeed *= bounceSpeedScaleDecay;
     }
 }
Example #38
0
 void OnLand(EntityMovement entMove)
 {
     mJumpSpd *= 0.8f;
     entMove.Jump(mJumpSpd, false);
 }
Example #39
0
 void onDirXChange(EntityMovement em)
 {
     if(mMelee != null) {
         switch(mMeleeMode) {
         case Melee.On:
             if(em.orientXSprite != null) {
                 Vector3 s = mMelee.transform.localScale;
                 s.x = Mathf.Sign(em.orientXSprite.scale.x);
                 mMelee.transform.localScale = s;
             }
             break;
         }
     }
 }
Example #40
0
    // Use this for initialization
    public void Start()
    {
        this.spawnController = FindObjectOfType<EnemySpawnController>();
        this.entityMovement = GetComponent<EntityMovement>();
        this.animator = animator = GetComponent<Animator>();
        dieSound = Resources.Load("Audio/monster_die") as AudioClip;

        boxCollider = GetComponent<BoxCollider2D>();
        circleCollider = GetComponent<CircleCollider2D>();
    }