Пример #1
0
        private void TeleportAbility()
        {
            CancelShooting();
            teleporting        = true;
            abilityTwoCooldown = abilityTwoMaxCooldown;
            ChangeAnimation(ref currentAnimation, teleportInAnimation);
            ChangeAnimation(ref currentHandAnimation, handTeleportInAnimation);
            UpdateSpriteEffect();
            teleportOutAnimation.XIndex = 0;
            teleportInAnimation.XIndex  = 0;
            abilityTwoCooldown          = 6;

            HoTEffect hoTEffect = new HoTEffect(iceBlockHealAmount, 4, this);

            Vector2 teleportVelocity;

            teleportVelocity.Y = (float)(Math.Sin(aimDirection) * speed);
            teleportVelocity.X = (float)(Math.Cos(aimDirection) * speed);

            newPosition = Position + (teleportVelocity * 100);

            Ability ability = new TeleportAbility(this, newPosition, speed, direction);

            abilityBuffer.Add(ability);
        }
Пример #2
0
        public void TeleportAbility(int index)
        {
            //Get the active unit's location
            int aux = this.activeUnit.sprite.xInd;
            int auy = this.activeUnit.sprite.yInd;

            //If this unit is not yet teleporting, display the teleporting UI
            if (!this.teleporting)
            {
                //Clear the grid
                this.UIGrid.Clear();
                //Get the teleport radius from the skill
                this.teleportRadius = this.activeUnit.Abilities[index].Radius;
                //Draw teleporting possibilities
                //Set the possible teleport region
                this.UIGrid.SetRegion(UIGridCell.CellState.TeleportPossible, aux, auy, this.activeUnit.Abilities[index].Range);
                //Default the teleport hover to the unit's location
                this.teleportHoverX = aux;
                this.teleportHoverY = auy;
                //Set teleporting to true
                this.teleporting = true;
            }
            else
            {
                //If the user clicked to start the teleport
                if (this.teleport)
                {
                    TeleportAbility ability = (TeleportAbility)this.activeUnit.Abilities[index];
                    ability.SetTarget(this.teleportHoverX, this.teleportHoverY);
                    ability.ApplyTo(this.teleportTargetX, this.teleportTargetY);
                    this.UIGrid.Clear();
                    this.teleporting            = false;
                    this.teleport               = false;
                    this.teleportTargetSelected = false;
                    this.teleportTargetX        = -1;
                    this.teleportTargetY        = -1;
                    this.activeUnit.hasAttacked = true;
                    this.activeUnit.MovesLeft  -= 1;
                    this.skillNum               = -1;
                    //Else, if they are still trying to teleport
                }
                else
                {
                    //Set the possible teleport region
                    this.UIGrid.SetRegion(UIGridCell.CellState.TeleportPossible, aux, auy, this.activeUnit.Abilities[index].Range);
                    //Set cells covered by the AOE to TeleportActive
                    this.UIGrid.SetRegion(UIGridCell.CellState.TeleportActive, this.teleportHoverX, this.teleportHoverY, this.teleportRadius);
                    if (this.teleportTargetX > 0)
                    {
                        //Set cells in the target area to teleport active
                        this.UIGrid.SetRegion(UIGridCell.CellState.TeleportActive, this.teleportTargetX, this.teleportTargetY, this.teleportRadius);
                    }
                }
            }
        }
    // Start is called before the first frame update
    void Start()
    {
        if (this.gameObject.GetComponent <PhotonView>().IsMine)
        {
            chargeMeter = GameObject.FindGameObjectWithTag("ChargeMeter").GetComponent <AbilityChargeMeter>();
            chargeMeter.InitizalizeMeter(this);
        }

        jumpAbility     = GetComponent <JumpAbility>();
        teleportAbility = GetComponent <TeleportAbility>();

        carRigidbody = this.GetComponent <Rigidbody>();

        networkCharacter = GetComponent <NetworkCharacter>();
    }
Пример #4
0
 // Use this for initialization
 void Start()
 {
     rb2d                            = GetComponent <Rigidbody2D>();
     pc2d                            = GetComponent <PolygonCollider2D>();
     gravity                         = GetComponent <GravityAccepter>();
     mainCamCtr                      = Camera.main.GetComponent <CameraController>();
     gm                              = GameObject.FindGameObjectWithTag("GestureManager").GetComponent <GestureManager>();
     hm                              = GetComponent <HardMaterial>();
     hm.shattered                   += shattered;
     tpa                             = GetComponent <TeleportAbility>();
     fta                             = GetComponent <ForceTeleportAbility>();
     wca                             = GetComponent <WallClimbAbility>();
     sba                             = GetComponent <ShieldBubbleAbility>();
     halfWidth                       = GetComponent <SpriteRenderer>().bounds.extents.magnitude;;
     sba.maxGestureRange             = halfWidth;
     fta.maxGestureRange             = halfWidth * 8;
     teleportRangeParticalController = teleportRangeParticalObject.GetComponent <ParticleSystemController>();
 }
Пример #5
0
 private void StartNextAbility()
 {
     try
     {
         tempPatternAttack = (PatternAttack)abilities[activeAbility];
         StartCoroutine("PatternAttackSpawner");
     }
     catch
     {
         try
         {
             tempTeleport = (TeleportAbility)abilities[activeAbility];
             StartCoroutine("Teleport");
         }
         catch
         {
             Debug.Log("no ability worked");
         }
     }
 }
Пример #6
0
        private void AssignTP()
        {
            face.Ability = face.gameObject.AddComponent <TeleportAbility>();

            TeleportAbility tp = face.GetComponent <TeleportAbility>();

            tp.thisPos = tp.FindCenter(face);

            if (_mScript.tpFaces[0] == null)
            {
                _mScript.tpFaces[0] = tp;
            }
            else if (_mScript.tpFaces[1] == null)
            {
                _mScript.tpFaces[1] = tp;

                _mScript.tpFaces[0].OtherPos = _mScript.tpFaces[1].thisPos;
                _mScript.tpFaces[1].OtherPos = _mScript.tpFaces[0].thisPos;
            }

            SetMaterial();
            UpdateUses();
            GameManager.SharedInstance.AudioManager.PlaySoundEffect(GameManager.SharedInstance.AudioManager.AbilityAssign);
        }
Пример #7
0
        public BoardCoordinatesViewModel(ConnectionProxy connectionProxy, Player mainPlayer, Enemy mainEnemy)
        {
            _connectionProxy = connectionProxy;
            MainPlayer       = mainPlayer;

            memento         = new MementoCareTaker();
            memento.Memento = MainPlayer.CreateMemento();

            MainEnemy = mainEnemy;
            Random randNum = new Random();

            UniqueID  = randNum.Next(100, 255);
            UniqueID2 = randNum.Next(100, 255);
            UniqueID3 = randNum.Next(100, 255);

            CurrentPlayer.color = UniqueID.ToString() + " " + UniqueID2.ToString() + " " + UniqueID3.ToString();

            enemySteal    = new StealPointsAbility();
            teleportEnemy = new TeleportAbility();
            dazeEnemy     = new DazePlayerAbility();

            enemySteal.SetEnemy(MainEnemy);
            teleportEnemy.SetEnemy(enemySteal);
            dazeEnemy.SetEnemy(teleportEnemy);


            for (int x = 0; x < 20; x++)
            {
                for (int y = 0; y < 20; y++)
                {
                    TilesSet.AddTile(x, y, new Tile(false, true, TileType.Neutral, x, y));
                }
            }

            //playerColor = UniqueID.ToString() + " " + UniqueID2.ToString() + " " + UniqueID3.ToString();
            //playerColor.Color = Color.FromArgb(255, 255, 255, 0);

            //SendCoordinatesCommand = new SendCoordinatesChatMessageCommand(this, chatService);
            MoveDownChatMessageCommand  = new MoveDownChatMessageCommand(this, _connectionProxy, MainPlayer);
            MoveLeftChatMessageCommand  = new MoveLeftChatMessageCommand(this, _connectionProxy, MainPlayer);
            MoveRightChatMessageCommand = new MoveRightChatMessageCommand(this, _connectionProxy, MainPlayer);
            MoveUpChatMessageCommand    = new MoveUpChatMessageCommand(this, _connectionProxy, MainPlayer);
            Pause       = new Pause(this, _connectionProxy);
            RestartGame = new RestartGame(this, _connectionProxy);

            _message = "Waiting for response";

            x           = MainPlayer.PosX;
            y           = MainPlayer.PosY;
            playerColor = MainPlayer.Color;

            /* CHAIN OF RESPONSIBILITY */

            EnemyDamageDealer    = new EnemyDamage();
            MagicianDamageDealer = new MagicianDamage();
            ThiefDamageDealer    = new ThiefDamage();
            IceDamageDealer      = new IceDamage();

            IceDamageDealer.SetSuccessor(ThiefDamageDealer);
            ThiefDamageDealer.SetSuccessor(MagicianDamageDealer);
            MagicianDamageDealer.SetSuccessor(EnemyDamageDealer);

            /* CHAIN OF RESPONSIBILITY */

            CurrentPlayer.x = x;
            CurrentPlayer.y = y;

            _connectionProxy.AddMessageReceiver(ChatService_CoordinatesMessageReceived);

            //chatService.CoordinatesReceived += ChatService_CoordinatesMessageReceived;
            facade = new Facade(_connectionProxy);

            root = new Effect(ComponentType.Effect);
            //Buffai

            Effect buff         = new Effect(ComponentType.Buff);
            Effect negativeBuff = new Effect(ComponentType.Negative); //negative
            Effect positiveBuff = new Effect(ComponentType.Positive); //positive

            positiveBuff.Add(new CountLeaf(ComponentType.ColorSplash));
            positiveBuff.Add(new CountLeaf(ComponentType.FreezeOthers));

            negativeBuff.Add(new CountLeaf(ComponentType.BlackSplash));
            negativeBuff.Add(new CountLeaf(ComponentType.FreezeYourself));

            buff.Add(negativeBuff);
            buff.Add(positiveBuff);

            // /Buffai
            // Bonusai

            Effect bonus = new Effect(ComponentType.Bonus);

            bonus.Add(new CountLeaf(ComponentType.JackPot));
            bonus.Add(new CountLeaf(ComponentType.Normal));
            bonus.Add(new CountLeaf(ComponentType.Joke));

            //Bonusai

            root.Add(buff);
            root.Add(bonus);

            /* INTERPRETER DESIGN PATTERN IMPLEMENTATION */
            tree = new List <ExpressionRoman>();
            tree.Add(new ThousandExpression());
            tree.Add(new HundredExpression());
            tree.Add(new TenExpression());
            tree.Add(new OneExpression());
            /* INTERPRETER DESIGN PATTERN IMPLEMENTATION */


            /* VISITOR DESIGN PATTERN IMPLEMENTATION */
            game = new GameStructure();
            game.Attach(new Hard());

            BonusSpawnRate  bonusSpawn  = new BonusSpawnRate();
            BuffSpawnRate   buffSpawn   = new BuffSpawnRate();
            DebuffSpawnRate debuffSpawn = new DebuffSpawnRate();

            game.Accept(bonusSpawn);
            game.Accept(buffSpawn);
            game.Accept(debuffSpawn);
            /* VISITOR DESIGN PATTERN IMPLEMENTATION */

            /* Flyweight design pattern */


            /* Flyweight design pattern */
        }