Beispiel #1
0
 private void Die()
 {
     NotificationMaster.SendPlayerDeathNotification();
     AudioManager.PlayPlayerDeath();
     Instantiate(deathExplosion, transform.position, Quaternion.identity);
     gameObject.SetActive(false);
 }
Beispiel #2
0
 private void Die()
 {
     AudioManager.PlayEnemyDeath();
     Instantiate(deathExplosion, transform.position, Quaternion.identity);
     GetComponent <Animate>().enabled = false;
     GameObject.Destroy(this.gameObject);
     if (GetComponent <GhostAI>())
     {
         NotificationMaster.SendGhostDeathNotification(GetComponent <GhostAI>().stats);
     }
 }
Beispiel #3
0
        public async Task <IActionResult> UpdateNotificationMaster([FromBody] NotificationMaster NotificationMasterModel)
        {
            try
            {
                NotificationMasterModel.ModifiedBy   = "Admin";
                NotificationMasterModel.ModifiedDate = DateTime.Now;

                db.Entry(NotificationMasterModel).State = Microsoft.EntityFrameworkCore.EntityState.Modified;
                db.SaveChanges();
                return(Ok(NotificationMasterModel));
            }
            catch (Exception ex)
            {
                return(BadRequest());
            }
        }
Beispiel #4
0
 public async Task <IActionResult> CreateNotificationMaster([FromBody] NotificationMaster NotificationMasterModel)
 {
     try
     {
         //bannerMaster.EnquiryID = 0;
         NotificationMasterModel.CreatedBy    = "Admin";
         NotificationMasterModel.CreatedDate  = DateTime.Now;
         NotificationMasterModel.ModifiedBy   = "Admin";
         NotificationMasterModel.ModifiedDate = DateTime.Now;
         NotificationMasterModel.Active       = true;
         db.notificationMaster.Add(NotificationMasterModel);
         db.SaveChanges();
         return(Ok(NotificationMasterModel));
     }
     catch (Exception ex)
     {
         return(BadRequest());
     }
 }
Beispiel #5
0
    void OnTriggerEnter2D(Collider2D coll)
    {
        if (!activated)
        {
            ghostStats.timeOpen = Time.time - timeOpened;
            ghostStats.size     = size;

            // TODO(samkern): Should we record ALL ghosts killed while the rift is active, or just some? Should they decay over time?
            // ghosts alive during this rift's time in the level = ghosts currently alive plus ghosts murdered.
            ghostStats.totalGhostsInLevel       = (GhostManager.instance.children.Count + ghostStats.ghostsKilled);
            ghostStats.totalGhostAggressiveness = GhostManager.instance.TotalGhostAggressiveness();

            ghostStats.airTime = airborneTime / ghostStats.timeOpen;

            GhostManager.instance.SpawnGhost(ghostStats);

            NotificationMaster.SendCheckpointReachedNotification(Time.time - timeOpened);
            AudioManager.PlayDotPickup();
            Destroy(this.gameObject);
        }
    }
Beispiel #6
0
    void OnTriggerEnter2D(Collider2D coll)
    {
        if (!activated)
        {
            ghostStats.timeOpen = Time.time - timeOpened;

            // For reference, the player is .14 scale
            // TODO(samkern): Figure out an appropriate scaling measure between rift & ghost
            ghostStats.size = psRadius * 1.2f;

            // TODO(samkern): Should we record ALL ghosts killed while the rift is active, or just some? Should they decay over time?
            // ghosts alive during this rift's time in the level = ghosts currently alive plus ghosts murdered.
            ghostStats.totalGhostsInLevel       = (GhostManager.instance.children.Count + ghostStats.ghostsKilled);
            ghostStats.totalGhostAggressiveness = GhostManager.instance.TotalGhostAggressiveness();

            ghostStats.airTime = dashingTime / ghostStats.timeOpen;

            GhostManager.instance.SpawnGhost(ghostStats);

            NotificationMaster.SendCheckpointReachedNotification(Time.time - timeOpened);
            AudioManager.PlayDotPickup();
            Destroy(this.gameObject);
        }
    }
    void Update()
    {
        if (inputDisabled)
        {
            _velocity = new Vector2();
            return;
        }

        float x = Input.GetAxis("Horizontal");
        float y = Input.GetAxis("Vertical");

        bool dash       = Input.GetKeyDown(KeyCode.JoystickButton18) || Input.GetKeyDown(KeyCode.UpArrow);
        bool dashCancel = Input.GetKeyUp(KeyCode.JoystickButton18) || Input.GetKeyUp(KeyCode.UpArrow);

        bool fire = Input.GetAxisRaw("Fire") <= 0.0f;

        if (!fire)
        {
            shooting = false;
        }
        else if (fire && !shooting)
        {
            _animate.AnimateToColorAndBack(Palette.PlayerColor, Color.red, .05f);

            shooting = true;
            NotificationMaster.SendPlayerShootNotification();
            AudioManager.PlayEnemyShoot();

            //float direction = spriteFlipped ? -1 : 1;
            Vector2 direction = new Vector2(x, y).normalized;
            if (direction == Vector2.zero)
            {
                direction.x = spriteFlipped;
            }
            GameObject missile = Instantiate(projectile, ProjectileManager.myTransform);
            missile.transform.position = transform.position + Vector3.Scale(playerSize, direction.normalized);
            missile.GetComponent <Missile>().Initialize(direction.normalized, projectileSpeed);
        }

        // xbox

        /*float fireX = Input.GetAxis ("FireX");
         * float fireY = Input.GetAxis ("FireY");
         * if (Mathf.Abs(fireX) > .5f||Mathf.Abs(fireY) > .5f)
         *      fire = true;*/

        if (Mathf.Abs(x) > .3)
        {
            speed.x = x * runSpeed;
            if (spriteFlipped * x < 0)
            {
                FlipPlayer();
            }
        }
        else
        {
            speed.x = 0;
        }

        if (Mathf.Abs(y) > .3)
        {
            speed.y = y * runSpeed;
        }
        else
        {
            speed.y = 0;
        }


        // apply horizontal speed smoothing it. dont really do this with Lerp. Use SmoothDamp or something that provides more control
        var smoothedMovementFactor = 2 * groundDamping;        //_controller.isGrounded ? groundDamping : inAirDamping; // how fast do we change direction?

        _velocity = Vector2.Lerp(_velocity, speed, Time.deltaTime * smoothedMovementFactor);

        _controller.move(_velocity * Time.deltaTime);

        // grab our current _velocity to use as a base for all calculations
        _velocity = _controller.velocity;
    }
Beispiel #8
0
 public void PressRestartButton()
 {
     NotificationMaster.SendRestartNotification();
 }