GetInstance() public static method

public static GetInstance ( ) : BulletManager,
return BulletManager,
Exemplo n.º 1
0
    public override ResultType DoAction()
    {
        if (null == _owner.Enemy)
        {
            return(ResultType.Fail);
        }

        _owner.SubEnergy(0.01f);

        if (Time.realtimeSinceStartup - _lastAttackTime <= _attackInterval)
        {
            return(ResultType.Running);
        }
        _lastAttackTime = Time.realtimeSinceStartup;

        BulletData bulletData = new BulletData();

        bulletData.startPos = _owner.Position;
        bulletData.target   = _owner.Enemy.transform;
        bulletData.speed    = 5f;
        bulletData.damage   = 5;
        BulletManager.GetInstance().AddBullet(bulletData);

        return(ResultType.Success);
    }
Exemplo n.º 2
0
 public void Shoot(float direction, float startingSpeed)
 {
     LaunchSpeed = startingSpeed;
     Velocity    = startingSpeed;
     Direction   = direction;
     BulletManager.GetInstance().AddBullet(this);
 }
Exemplo n.º 3
0
    public void OnUpdate(float deletaTime)
    {
        bool bulletActivat = false;

        for (int i = 0; i < infolist.Count; ++i)
        {
            infolist[i].CreateTimeCount += deletaTime;
            if (infolist[i].CreateTimeCount >= infolist[i].CreateTime)
            {
                setTweenAngle(i);

                BasicBullet temp = BulletManager.GetInstance().GetBullet();

                temp.OnActive(infolist[i].TweenAngle, 730f, _bulletAnimationTime);

                infolist[i].listMyBullet.Add(temp);
                infolist[i].CreateTimeCount = 0f;

                bulletActivat = true;
            }

            for (int j = 0; j < infolist[i].listMyBullet.Count; ++j)
            {
                infolist[i].listMyBullet[j].SetBulletAngleInfo(infolist[i].TweenAngle);
            }
        }

        if (bulletActivat)
        {
            _direction *= -1;
        }
    }
Exemplo n.º 4
0
    public void OnUpdate(float deletaTime)
    {
        for (int i = 0; i < infolist_left.Count; ++i)
        {
            infolist_left[i].CreateTimeCount += deletaTime;
            if (infolist_left[i].CreateTimeCount >= infolist_left[i].CreateTime)
            {
                BasicBullet temp = BulletManager.GetInstance().GetBullet();

                temp.OnActive(infolist_left[i].TweenAngle, 730f, _bulletAnimationTime);

                infolist_left[i].listMyBullet.Add(temp);
                infolist_left[i].CreateTimeCount = 0f;
            }
        }


        for (int i = 0; i < infolist_right.Count; ++i)
        {
            infolist_right[i].CreateTimeCount += deletaTime;
            if (infolist_right[i].CreateTimeCount >= infolist_right[i].CreateTime)
            {
                BasicBullet temp = BulletManager.GetInstance().GetBullet();

                temp.OnActive(infolist_right[i].TweenAngle, 730f, _bulletAnimationTime);

                infolist_right[i].listMyBullet.Add(temp);
                infolist_right[i].CreateTimeCount = 0f;
            }
        }
    }
Exemplo n.º 5
0
    public void CreateNewPattern()
    {
        if (!GameManager.GetInstance().IsDie&& BulletManager.GetInstance().CheckBullet())
        {
            if (!GameManager.GetInstance().IsNextLevel)
            {
                if (GameManager.GetInstance().LevelCnt >= GameManager.GetInstance().MaxLevel)
                {
                    GameManager.GetInstance().IsNextLevel = true;
                    GameManager.GetInstance().StartNextLevel();
                    return;
                }
                int Pattern = Random.Range(0, 10);

                while (Pattern == _prvePattern)
                {
                    Pattern = Random.Range(0, 10);
                }

                SetPattern(Pattern);
                _prvePattern      = Pattern;
                _patternTimeCount = 0f;
                GameManager.GetInstance().LevelCnt++;
                Debug.Log(GameManager.GetInstance().LevelCnt);
            }
        }
    }
Exemplo n.º 6
0
 // Update is called once per frame
 void Update()
 {
     // 驱动 Sprite 管理器
     SpriteManager.GetInstance().Update();
     // 驱动 bullet 管理器
     BulletManager.GetInstance().Update();
 }
Exemplo n.º 7
0
 private void _CheckBounds()
 {
     if (Vector3.Distance(transform.position, Vector3.zero) > range)
     {
         // bulletManager.ReturnBullet(this.gameObject);
         BulletManager.GetInstance().ReturnBullet(this.gameObject);
     }
 }
Exemplo n.º 8
0
    public void OnUpdate(float deletaTime)
    {
        _patternTimeCheck += deletaTime;
        for (int i = 0; i < infolist.Count; ++i)
        {
            infolist[i].StartWaveTimeCount += deletaTime;
            if (infolist[i].StartWaveTimeCount >= infolist[i].StartWaveTime)
            {
                if (!infolist[i].IsMoveUse)
                {
                    if (i == 0)
                    {
                        infolist[i].TweenAngle = GameManager.GetInstance().player.GetAngle() - _startAngle;
                    }
                    else
                    {
                        infolist[i].TweenAngle = GameManager.GetInstance().player.GetAngle() + _startAngle;
                    }
                }
                if (!infolist[i].IsUse)
                {
                    infolist[i].IsUse = true;
                }
                infolist[i].CreateTimeCount += deletaTime;
                if (infolist[i].CreateTimeCount >= infolist[i].CreateTime)
                {
                    BasicBullet temp = BulletManager.GetInstance().GetBullet();

                    temp.OnActive(infolist[i].TweenAngle, 730f, _bulletAnimationTime);

                    infolist[i].listMyBullet.Add(temp);
                    infolist[i].CreateTimeCount = 0f;
                }
            }

            if (_patternTimeCheck >= _startWaveTime * infolist.Count + _bulletAnimationTime)
            {
                if (isAllUse())
                {
                    if (!infolist[i].IsMoveUse)
                    {
                        infolist[i].IsMoveUse = true;
                        setTweenAngle(i);
                    }
                }
            }
            if (!infolist[i].IsMoveUse)
            {
                for (int j = 0; j < infolist[i].listMyBullet.Count; ++j)
                {
                    infolist[i].listMyBullet[j].SetBulletAngleInfo(infolist[i].TweenAngle);
                }
            }
        }
    }
Exemplo n.º 9
0
    // Use this for initialization
    void Start()
    {
        Netman = NetworkManager.Instance;
        gm     = GameManager.GetInstance();
        BM     = BulletManager.GetInstance();

        VelocityX    = 0f;
        VelocityY    = 0f;
        IsShooting   = false;
        RealPosition = gameObject.transform.position;
    }
Exemplo n.º 10
0
    // Update is called once per frame
    void Update()
    {
        for (int i = 0; i < _spriteList.Count; ++i)
        {
            _spriteList[i].Update();
        }

        _spriteBTUpdateManager.Update();

        BulletManager.GetInstance().Update();
    }
Exemplo n.º 11
0
 // original function for changing the bullet
 private void ChangeBullet()
 {
     // this will need to be changed to updated input system
     if (Input.GetKeyDown(KeyCode.Alpha1) || Input.GetKeyDown(KeyCode.Keypad1))
     {
         BulletManager.GetInstance().SetCurrentBulletType(0);
     }
     else if (Input.GetKeyDown(KeyCode.Alpha2) || Input.GetKeyDown(KeyCode.Keypad2))
     {
         BulletManager.GetInstance().SetCurrentBulletType(1);
     }
 }
Exemplo n.º 12
0
 // fires the bullet
 private void FireBullet()
 {
     if (fireBullet)
     {
         // delays firing
         if (Time.frameCount % fireRate == 0)
         {
             var tempBullet = BulletManager.GetInstance().GetBullet(bulletSpawn.position, bulletSpawn.forward);
             tempBullet.transform.SetParent(BulletManager.GetInstance().parentObject.transform);
         }
     }
 }
Exemplo n.º 13
0
    public void CreateEndPop()
    {
        for (int i = 0; i < 500; ++i)
        {
            GameObject obj = Instantiate(endFXPrefab);
            _listEndPop.Add(obj.GetComponent <ParticleSystem>());

            obj.name                    = "EndPop_" + i;
            obj.transform.parent        = BulletManager.GetInstance().transform;
            obj.transform.localScale    = new Vector3(95f, 95f, 1f);
            obj.transform.localPosition = new Vector3(0f, 0f, 0f);
            obj.gameObject.SetActive(false);
        }
    }
Exemplo n.º 14
0
    // fires bullet (original function)
    private void _Fire()
    {
        if (Input.GetAxisRaw("Fire1") > 0.0f)
        {
            // delays firing
            if (Time.frameCount % fireRate == 0)
            {
                // var tempBullet = bulletManager.GetBullet(bulletSpawn.position, bulletSpawn.forward);
                // tempBullet.transform.SetParent(bulletManager.gameObject.transform);

                var tempBullet = BulletManager.GetInstance().GetBullet(bulletSpawn.position, bulletSpawn.forward);
                tempBullet.transform.SetParent(BulletManager.GetInstance().parentObject.transform);
            }
        }
    }
Exemplo n.º 15
0
 protected override void Initialize()
 {
     base.Initialize();
     _bulletManager = BulletManager.GetInstance();
     PictureBoxSizeChanged(null, null);
     CurrentItem = Item.GetItemByTileId(0);
     VariableProvider.GraphicsDevice  = GraphicsDevice;
     VariableProvider.ClientBounds    = new Rectangle(ClientRectangle.X, ClientRectangle.Y, ClientRectangle.Width, ClientRectangle.Height);
     VariableProvider.ScriptEngine    = new ScriptEngine();
     VariableProvider.Content         = Editor.Content;
     VariableProvider.Exit            = Application.Exit;
     GameVariableProvider.SaveManager = new SaveManager <SaveState>();
     Layer     = InteractiveLayer;
     DrawAll   = true;
     MapLoaded = false;
     LoadContent();
 }
Exemplo n.º 16
0
    // Use this for initialization
    void Start()
    {
        Netman = NetworkManager.Instance;//.GetInstance();
        gm     = GameManager.GetInstance();
        Netman.Enemy.animation.Play("idle");

        Animation a = Netman.Enemy.animation;

        //a.animation["laying"].blendMode = AnimationBlendMode.Additive;
        a.animation["laying"].layer = 1;
        a.Play("laying");

        a.animation["walkleft"].layer  = 1;
        a.animation["walkright"].layer = 1;
        a.animation["crabdeath"].layer = 1;


        BulletSmallShot  = Resources.Load("Bullets/EnemySmallShot");
        BulletSpawnShot  = Resources.Load("Bullets/EnemySpawnShot");
        SoundRegularShot = Resources.Load("Sounds/SpawnShotFire");

        BMan = BulletManager.GetInstance();

        RealPosition = transform.position;
        RealRotation = transform.rotation;

        CurrentTarget = new Vector3(0f, transform.position.y, -50f);

        CurrentHealth = 2000;

        SyncLerp = 0f;
        RealLerp = 0f;

        white = GameObject.Find("White");
        if (white != null)
        {
            white.active = false;             //Stupid being unable to find an inactive game object...
        }
#if Use_Vectrosity
        Boundary = new VectorLine("Boundary", new Vector3[100], BoundaryMat, 3f);
        Vector.MakeCircleInLine(Boundary, new Vector3(0f, 1.5f, 0f), Vector3.up, 12f); //It should be 150 radius but the object we're taking transform of is scale 10
#endif
    }
Exemplo n.º 17
0
        public bool Update()
        {
            BulletManager.GetInstance().ClearAllBullets();
            VariableProvider.ScriptEngine.StopAllScripts();
            _elapsedSeconds += ShortCuts.ElapsedSeconds;
            if (GameStateManager.FastDead || _elapsedSeconds >= TimeToAutoResume || InputMapper.StrictAction)
            {
                if (GameVariableProvider.SaveManager.CurrentSaveState.CurrentLevel != LevelManager.CurrentLevel)
                {
                    LevelManager.ReloadLevel <Map <TileCode>, TileCode>();
                }
                else
                {
                    GameVariableProvider.SaveManager.Load(VariableProvider.SaveSlot);
                }
                GameStateManager.PlayerDead = false;
                _elapsedSeconds             = 0f;
            }

            return(true);
        }
Exemplo n.º 18
0
    public void OnUpdate(float deletaTime)
    {
        if (_BallCnt >= _totalBallNumber)
        {
            _tweening = false;
            return;
        }
        _createTimeCount += Time.deltaTime;

        if (_createTimeCount >= _createTime)
        {
            _createTime = Random.Range(0.0f, 0.1f);
            float Angle          = Random.Range(0f, 360f);
            float BulletMoveTime = Random.Range(1.0f, 2.0f);

            BasicBullet temp = BulletManager.GetInstance().GetBullet();

            temp.OnActive(Angle, 730f, BulletMoveTime);
            _createTimeCount = 0f;
            _BallCnt++;
        }
    }
Exemplo n.º 19
0
 private void PlayButtonClick(object sender, EventArgs e)
 {
     if (!Game.MapLoaded)
     {
         return;
     }
     Game.Playing = !Game.Playing;
     if (Game.Playing)
     {
         Game.SaveMap(_currentMapName);
         _focusTextbox.Focus();
         _focusTextbox.LostFocus += RefocusInputBox;
         Camera.UpdateWorldRectangle(Game.TileMap);
         GameVariableProvider.SaveManager.CurrentSaveState = new SaveState();
     }
     else
     {
         Game.LoadMap(_currentMapName);
         _focusTextbox.LostFocus -= RefocusInputBox;
         BulletManager.GetInstance().ClearAllBullets();
     }
 }
Exemplo n.º 20
0
    // changes the bullet
    public void OnBulletTypeChange(InputAction.CallbackContext context)
    {
        // Debug.Log("Control Name: " + context.control.name);

        // int bulletInt = context.ReadValue<int>();
        int bulletInt = 0;

        // due to the way this works, it provides a number 1 less than the number selected.
        switch (context.control.name)
        {
        case "1":
        case "numpad1":
            bulletInt = 0;
            break;

        case "2":
        case "numpad2":
            bulletInt = 1;
            break;

        case "3":
        case "numpad3":
            bulletInt = 2;
            break;

        case "4":
        case "numpad4":
            bulletInt = 3;
            break;

        default:
            break;
        }

        // changes type
        BulletManager.GetInstance().SetCurrentBulletType(bulletInt);
    }
Exemplo n.º 21
0
        public void OnLevelLoad()
        {
            CodeManager <TileCode> .CheckCodes <Map <TileCode> >();

            BulletManager.GetInstance().ClearAllBullets();
        }
    public void OnUpdate(float deletaTime)
    {
        for (int i = 0; i < infolist.Count; ++i)
        {
            infolist[i].StartWaveTimeCount += deletaTime;
            if (infolist[i].StartWaveTimeCount >= infolist[i].StartWaveTime)
            {
                if (!infolist[i].IsUse)
                {
                    infolist[i].IsUse = true;
                    if (i == 0)
                    {
                        infolist[i].TweenAngle = GameManager.GetInstance().player.GetAngle();
                        _startAngle            = GameManager.GetInstance().player.GetAngle();
                    }
                    else
                    {
                        if (i == 1)
                        {
                            if (_startAngle >= GameManager.GetInstance().player.GetAngle())
                            {
                                IsRight = true;
                            }
                            else
                            {
                                IsRight = false;
                            }
                        }
                        if (IsRight)
                        {
                            infolist[i].TweenAngle = _startAngle + (360f - (360f / infolist.Count) * i);
                        }
                        else
                        {
                            infolist[i].TweenAngle = _startAngle - (360f - (360f / infolist.Count) * i);
                        }
                    }
                }
                infolist[i].CreateTimeCount += deletaTime;
                if (infolist[i].CreateTimeCount >= infolist[i].CreateTime)
                {
                    BasicBullet temp = BulletManager.GetInstance().GetBullet();

                    temp.OnActive(infolist[i].TweenAngle, 730f, _bulletAnimationTime);

                    infolist[i].listMyBullet.Add(temp);
                    infolist[i].CreateTimeCount = 0f;
                }
            }

            if (isAllUse())
            {
                if (!infolist[i].IsMoveUse)
                {
                    infolist[i].IsMoveUse = true;
                    setTweenAngle(i);
                }
            }

            //for (int j = 0; j < infolist[i].listMyBullet.Count; ++j)
            //{
            //    infolist[i].listMyBullet[j].SetBulletAngleInfo(infolist[i].TweenAngle);
            //}
        }
    }