Inheritance: MonoBehaviour
示例#1
0
    void Start()
    {
        parent = GameObject.Find("Charger").GetComponent<Collider>();
        player = GameObject.Find("Player").GetComponent<PlayerScript>();

        myCollider = gameObject.GetComponent<Collider>();
    }
示例#2
0
 void Start()
 {
     //ph = GameObject.Find ("PlanetHandler").GetComponent<PlanetHandler> ();
     //ph.SetOxygenLevel (100);
     ps = GameObject.FindWithTag ("Player").GetComponent<PlayerScript> ();
     ps.onAirArea = true;
 }
示例#3
0
    void Awake()
    {
        VariableResourcesScript vrs = GetComponent<VariableResourcesScript>();

        players = GameObject.FindGameObjectsWithTag("Player");

        objPlayer1 = vrs.objPlayer1;
        scrPlayerScript1 = objPlayer1.GetComponent<PlayerScript>();
        scrPlayerExperience1 = objPlayer1.GetComponent<PlayerStats>();
        scrPlayerHealthScript1 = objPlayer1.GetComponent<PlayerHealthScript>();
        scrPlayerShoot1 = objPlayer1.GetComponent<PlayerShoot>();
        //objPlayer2 = vrs.objPlayer2;

        playersTag = objPlayer1.tag;
        // 8: Enemy, 15: Spawn Point, 20: Flying, 24: Neutral, 25: Immune
        intEnemyLayerMask = 1 << LayerMask.NameToLayer("Enemy") | 1 << LayerMask.NameToLayer("Flying") | 1 << LayerMask.NameToLayer("Neutral") | 1 << LayerMask.NameToLayer("Immune") | 1 << LayerMask.NameToLayer("Spawn Point");
        intHostileLayerMask = 1 << LayerMask.NameToLayer("Enemy") | 1 << LayerMask.NameToLayer("Spawn Point") | 1 << LayerMask.NameToLayer("Immune");
        intPlayerUnitsLayerMask = 1 << LayerMask.NameToLayer("Player");

        objBullet = vrs.objBullet;
        objExplodingShot = vrs.objExplodingShot;
        objArrow = vrs.objArrow;
        objFire = vrs.objFire;
        objExplosion = vrs.objExplosion;

        objTemp = vrs.objTemp;

        objText = vrs.objText;

        texAttribute = vrs.texAttribute;

        matLineOfSightSolid = vrs.matLineOfSight;
        matLineOfSightTransparent = vrs.matLineOfSightTransparent;
        matSkull = vrs.matSkull;
    }
示例#4
0
	void Awake() {
		if (S) {
			Debug.Log("Multiple players. Error.");
			return;
		}
		S = this;
	}
示例#5
0
    private PlayerScript m_Player; //Référence au script playerScript

    #endregion Fields

    #region Methods

    // Use this for initialization
    void Awake()
    {
        //Initialise les références
        m_Player = GameObject.Find("Character").GetComponent<PlayerScript>();
        m_AtTopCheck = transform.Find("Top");
        m_AtBotCheck = transform.Find("Bot");
    }
示例#6
0
 void Start() {
     player = GameObject.FindWithTag( "Player" ).GetComponent<PlayerScript>();
     opNumSet = GetComponent<OperatorNumberSetScript>();
     opNumSet.operatorSide = operatorSide;
     StartCoroutine( UpdateNumberRenderer() );
     StartCoroutine( Move() );
 }
示例#7
0
 // Use this for initialization
 void Start()
 {
     camera.orthographicSize = CurrentZoom;
     GameObject test;
     test = GameObject.Find ("PlayerObject");
     playerscript = test.GetComponent<PlayerScript>();
 }
示例#8
0
	private void Init(){
		this.gameManager = GameObject.Find ("GameManager").GetComponent<GameManager> ();
		this.player = GameObject.Find ("Player").GetComponent<PlayerScript> ();
		this.enemy = GameObject.Find ("Enemy").GetComponent<EnemyScript> ();
		this.mPlayerShieldHP = Constants.ShieldPoint;
		this.mEnemyShieldHP = Constants.ShieldPoint;
	}
示例#9
0
 new void Awake()
 {
     Application.LoadLevelAdditive("ScoreScene");
     base.Awake();
     instance = this;
     currentPhysical = maxPhysical;
 }
示例#10
0
 void Start()
 {
     canvas = GameObject.Find ("Canvas");
     multScoreText = canvas.transform.FindChild("multScore").gameObject.GetComponent<Text>();
     p = GameObject.Find ("Player");
     pScript = p.GetComponent<PlayerScript> ();
 }
示例#11
0
 public void PickUpWeapon(PlayerScript p)
 {
     player = p;
     playerMove = player.GetComponent<PlayerMovementScript>();
     beingHeld = true;
     attacking = false;
 }
示例#12
0
 public void DropWeapon()
 {
     player = null;
     playerMove = null;
     beingHeld = false;
     attacking = false;
 }
示例#13
0
 public Term()
 {
     myCardScript = null;
     myUnitScript = null;
     myPlayerScript = null;
     myPosition = Vector3.zero;
 }
示例#14
0
    public void Purchase()
    {
        if (PortShopManager.Instance.DockedShip.Gold < Cost) return;

        PortShopManager.Instance.DockedShip.Gold -= Cost;
        Owner = PlayerScript.MyPlayer;
    }
示例#15
0
    void Update()
    {
        if(p1 == null)
        {
            p1 = GameObject.FindGameObjectWithTag("PLAYER1");
            if(p1 != null)
                player1 = p1.GetComponent<PlayerScript>();
        }
        if(p2 == null)
        {
            p2 = GameObject.FindGameObjectWithTag("PLAYER2");
            if(p2 != null)
                player2 = p2.GetComponent<PlayerScript>();
        }

        if(p1 == null || p2 == null)
            return;

        GameObject[] blackHoles = GameObject.FindGameObjectsWithTag("blackhole");
        foreach(GameObject bh in blackHoles)
        {
            BlackHoleScript blackHoleScript = bh.GetComponent<BlackHoleScript>();
            if(Network.isServer)
                player1.UpdateAgainstBlackHole(blackHoleScript);
            else if(Network.isClient)
                player2.UpdateAgainstBlackHole(blackHoleScript);
        }

        if(blackHoles.Length == 0)
            GameLogicController.instance.MoveToNextLevel();
    }
 void Awake()
 {
     if (spawnVectors.Length > 0)
     {
         for (int i = 0; i < spawnVectors.Length; i++)
         {
             if (spawnVectors[i].GetComponent<SpawnVectorScript>() == null)
             {
                 Debug.Log("SpawnVector GameObject No." + i + " does not have the required script Attached.");
                 errorHasOccured = true;
                 break;
             }
         }
         if (!errorHasOccured)
         {
             for (int i = 0; i < spawnVectors.Length - 1; i++)
             {
                 spawnVectors[i].Direction(spawnVectors[i + 1].transform.position);
             }
         }
         else
             Debug.Log("Fix the error before continuing playing the game.");
     }
     player = GameObject.FindGameObjectWithTag("Player").GetComponent<PlayerScript>();
     playerEmo = GameObject.FindGameObjectWithTag("MainCamera").GetComponent<PlayerEmotions>();
     spawn = spawnVectors[0].transform.position;
 }
示例#17
0
 public static void addScore(PlayerScript player, int score)
 {
     if (player == script0)
         playerScore0 += score;
     else if(player == script1)
         playerScore1 += score;
 }
    public void AdquireJogadores()
    {
        /*
        players= GameObject.FindGameObjectsWithTag ("jogador");

        foreach (GameObject atual in players) {

            atual.GetComponent<PlayerScript> ().posicao_atual = 2;
            scriptsplayers.Add (atual.GetComponent<PlayerScript> ());
        }
        num_players = scriptsplayers.Count;
        player_atual = players [0];
        */

             GameObject[] temp = GameObject.FindGameObjectsWithTag ("jogador");

        players = new GameObject[temp.Length];

        foreach (GameObject atual in temp) {

            players [atual.GetComponent<PlayerScript> ().ordem] = atual;

            atual.GetComponent<PlayerScript> ().posicao_atual = 1;
            //	scriptsplayers.Add (atual.GetComponent<PlayerScript> ());
        }
        //num_players = scriptsplayers.Count;
        player_atual = players [0];
        addFlagPLayerAtual ();
        Atualizar_Texto ();
        script_atual = player_atual.GetComponent<PlayerScript> ();
        num_players = players.Length;
    }
示例#19
0
 // Use this for initialization
 void Start()
 {
     Player = (GameObject) GameObject.FindWithTag ("Player");
     playerScript = (PlayerScript) Player.gameObject.GetComponent(typeof(PlayerScript));
     gameTime = 0;
     portalScript = (PortalScript) GameObject.Find("Portal").GetComponent(typeof(PortalScript));
 }
 // Use this for initialization
 void Start()
 {
     GameObject playerGO = GameObject.FindWithTag ("Player");
     if (playerGO != null) {
         player = playerGO.GetComponent<PlayerScript>();
     }
 }
    // Use this for initialization
    void Start()
    {
        editor = (GeneralEditorScript)GameObject.FindWithTag("Editor").GetComponent("GeneralEditorScript");
        playerScript = (PlayerScript)GameObject.FindWithTag("Player").GetComponent("PlayerScript");

        initialRotation = transform.rotation;
    }
 // Use this for initialization
 void Start()
 {
     GameObject target = GameObject.FindWithTag ("Player");
     GameObject player = GameObject.FindWithTag ("Player");
     playerScript =  player.GetComponent<PlayerScript>();
     playerTr = player.transform;
 }
示例#23
0
 protected override void RemoveMe(PlayerScript ps)
 {
     if(ps!=null){
         GUIManager.FloatingTexture(meleeEffect,((ps.transform.position+transform.position)*.5f),.3f,4,1,0,0,4,12);
     }
     Destroy(gameObject);
 }
示例#24
0
 void Awake()
 {
     playerScript = GameObject.Find("Player").GetComponent<PlayerScript>();
     playerAnimator = GameObject.Find("Player").GetComponent<Animator>();
     normalSpeed = Time.timeScale;
     colorFilter = GameObject.Find("ColorFilter").GetComponent<ColorFilter>();
 }
    // Use this for initialization
    void Start()
    {
        _PlayerSt = GameObject.FindWithTag("player").GetComponent<PlayerScript>();
        _PlayerSt._attackChkCol = gameObject.GetComponent<BoxCollider>();

        gameObject.GetComponent<BoxCollider>().enabled = false;
    }
 // Use this for initialization
 void Start()
 {
     this.koopaShellScript = this.transform.parent.GetComponent<KoopaShellScript> ();
     this.player = GameObject.FindWithTag ("Player");
     this.playerScript = this.player.GetComponent<PlayerScript>();
     this.playerRb = this.player.GetComponent<Rigidbody2D>();
 }
示例#27
0
文件: GameScreen.cs 项目: C453/SOLAR
    private void Start()
    {
        Player = GameObject.FindGameObjectWithTag("Player").GetComponent<PlayerScript>();

        MessageBox.SetActive (false);
        OtherMessageBox.SetActive (false);
    }
示例#28
0
 // Use this for initialization
 void Start()
 {
     showScoreAdded = false;
     score = 0f;
     _playerScript = GameObject.Find("Player").GetComponent<PlayerScript>();
     scorePerSecond = 1f;
 }
示例#29
0
 // Use this for initialization
 void Start()
 {
     player = (PlayerScript)GameObject.Find("Player").GetComponent(typeof(PlayerScript));
     jumps = (Text)GameObject.Find ("Jumps").GetComponent (typeof(Text));
     gameOver = GameObject.Find ("GameOver");
     gameOver.SetActive(false);
 }
示例#30
0
 void Awake()
 {
     playerScript = GameObject.Find("Player").GetComponent<PlayerScript>();
     spriteRenderer = gameObject.GetComponent<SpriteRenderer>();
     objectRigidbody = GetComponent<Rigidbody2D>();
     debugScript = GetComponent<dynamicObjectDebug>();
 }
示例#31
0
 void Start()
 {
     PS = GameObject.FindObjectOfType <PlayerScript>();
 }
示例#32
0
 ///<summary>
 /// Triggers when the explorer targets people and found one
 ///</summary>
 ///<param name="player">PlayerScript from the found player</param>
 public virtual void ExplorePeople(PlayerScript player)
 {
 }
示例#33
0
 void Start()
 {
     base.Start();
     isPlaying    = false;
     playerScript = player.GetComponent <PlayerScript>();
 }
示例#34
0
    public IEnumerator SetPlayerLoadOuts()
    {
        //Waiting for player name resolve
        yield return(WaitUntilInControl());

        // Null Job players dont get a loadout
        if (playerScript.JobType == JobType.NULL)
        {
            yield break;
        }

        PlayerScript pS = GetComponent <PlayerScript>();

        pS.JobType = playerScript.JobType;

        JobOutfit standardOutfit = GameManager.Instance.StandardOutfit.GetComponent <JobOutfit>();
        JobOutfit jobOutfit      = GameManager.Instance.GetOccupationOutfit(playerScript.JobType);

        Dictionary <string, string> gear = new Dictionary <string, string>();

        gear.Add("uniform", standardOutfit.uniform);
        gear.Add("ears", standardOutfit.ears);
        gear.Add("belt", standardOutfit.belt);
        gear.Add("back", standardOutfit.backpack);
        gear.Add("shoes", standardOutfit.shoes);
        gear.Add("glasses", standardOutfit.glasses);
        gear.Add("gloves", standardOutfit.gloves);
        gear.Add("suit", standardOutfit.suit);
        gear.Add("head", standardOutfit.head);
        //gear.Add("accessory", standardOutfit.accessory);
        gear.Add("mask", standardOutfit.mask);
        //gear.Add("backpack", standardOutfit.backpack);
        //gear.Add("satchel", standardOutfit.satchel);
        //gear.Add("duffelbag", standardOutfit.duffelbag);
        //gear.Add("box", standardOutfit.box);
        //gear.Add("l_hand", standardOutfit.l_hand);
        //gear.Add("l_pocket", standardOutfit.l_pocket);
        //gear.Add("r_pocket", standardOutfit.r_pocket);
        //gear.Add("suit_store", standardOutfit.suit_store);

        if (!string.IsNullOrEmpty(jobOutfit.uniform))
        {
            gear["uniform"] = jobOutfit.uniform;
        }

        /*if (!String.IsNullOrEmpty(jobOutfit.id))
         *      gear["id"] = jobOutfit.id;*/
        if (!string.IsNullOrEmpty(jobOutfit.ears))
        {
            gear["ears"] = jobOutfit.ears;
        }
        if (!string.IsNullOrEmpty(jobOutfit.belt))
        {
            gear["belt"] = jobOutfit.belt;
        }
        if (!string.IsNullOrEmpty(jobOutfit.backpack))
        {
            gear["back"] = jobOutfit.backpack;
        }
        if (!string.IsNullOrEmpty(jobOutfit.shoes))
        {
            gear["shoes"] = jobOutfit.shoes;
        }
        if (!string.IsNullOrEmpty(jobOutfit.glasses))
        {
            gear["glasses"] = jobOutfit.glasses;
        }
        if (!string.IsNullOrEmpty(jobOutfit.gloves))
        {
            gear["gloves"] = jobOutfit.gloves;
        }
        if (!string.IsNullOrEmpty(jobOutfit.suit))
        {
            gear["suit"] = jobOutfit.suit;
        }
        if (!string.IsNullOrEmpty(jobOutfit.head))
        {
            gear["head"] = jobOutfit.head;
        }

        /*if (!String.IsNullOrEmpty(jobOutfit.accessory))
         *      gear["accessory"] = jobOutfit.accessory;*/
        if (!string.IsNullOrEmpty(jobOutfit.mask))
        {
            gear["mask"] = jobOutfit.mask;
        }

        /*if (!String.IsNullOrEmpty(jobOutfit.backpack))
         *      gear["backpack"] = jobOutfit.backpack;
         * if (!String.IsNullOrEmpty(jobOutfit.satchel))
         *      gear["satchel"] = jobOutfit.satchel;
         * if (!String.IsNullOrEmpty(jobOutfit.duffelbag))
         *      gear["duffelbag"] = jobOutfit.duffelbag;
         * if (!String.IsNullOrEmpty(jobOutfit.box))
         *      gear["box"] = jobOutfit.box;
         * if (!String.IsNullOrEmpty(jobOutfit.l_hand))
         *      gear["l_hand"] = jobOutfit.l_hand;
         * if (!String.IsNullOrEmpty(jobOutfit.l_pocket))
         *      gear["l_pocket"] = jobOutfit.l_pocket;
         * if (!String.IsNullOrEmpty(jobOutfit.r_pocket))
         *      gear["r_pocket"] = jobOutfit.r_pocket;
         * if (!String.IsNullOrEmpty(jobOutfit.suit_store))
         *      gear["suit_store"] = jobOutfit.suit_store;*/

        foreach (KeyValuePair <string, string> gearItem in gear)
        {
            if (gearItem.Value.Contains(ClothFactory.ClothingHierIdentifier) || gearItem.Value.Contains(ClothFactory.HeadsetHierIdentifier) ||
                gearItem.Value.Contains(ClothFactory.BackPackHierIdentifier) || gearItem.Value.Contains(ClothFactory.BagHierIdentifier))
            {
                GameObject obj = ClothFactory.Instance.CreateCloth(gearItem.Value, TransformState.HiddenPos, transform.parent);
                //if ClothFactory does not return an object then move on to the next clothing item
                if (!obj)
                {
                    Logger.LogWarning("Trying to instantiate clothing item " + gearItem.Value + " failed!", Category.Equipment);
                    continue;
                }
                ItemAttributes itemAtts = obj.GetComponent <ItemAttributes>();
                SetItem(GetLoadOutEventName(gearItem.Key), itemAtts.gameObject);
            }
            else if (!string.IsNullOrEmpty(gearItem.Value))
            {
                //					Logger.Log(gearItem.Value + " creation not implemented yet.");
            }
        }
        SpawnID(jobOutfit);

        yield return(new WaitForSeconds(3f));        //Wait a bit for headset to be fully setup and player to be fully spawned.

        if (playerScript.JobType == JobType.SYNDICATE)
        {
            //Check to see if there is a nuke and communicate the nuke code:
            NukeInteract nuke = FindObjectOfType <NukeInteract>();
            if (nuke != null)
            {
                UpdateChatMessage.Send(gameObject, ChatChannel.Syndicate,
                                       "We have intercepted the code for the nuclear weapon: " + nuke.NukeCode);
            }
        }
    }
示例#35
0
 private void Start()
 {
     networkIdentity      = GetComponent <NetworkIdentity>();
     playerNetworkActions = gameObject.GetComponent <PlayerNetworkActions>();
     playerScript         = gameObject.GetComponent <PlayerScript>();
 }
示例#36
0
 void Start()
 {
     player       = GameObject.FindGameObjectWithTag("Player");
     playerScript = player.GetComponent <PlayerScript>();
 }
示例#37
0
 public PlayerTarget(PlayerScript player)
 {
     this.player = player;
 }
示例#38
0
 public void GetCharScripts(PlayerScript player, EnemyScript enemy)
 {
     eScript = enemy;
     pScript = player;
 }
示例#39
0
 private void Start()
 {
     player = FindObjectOfType <PlayerScript>();
 }
示例#40
0
 public Landing(PlayerScript playerScript, PlayerMovementScript playerMovementScript) : base(playerScript, playerMovementScript)
 {
 }
示例#41
0
        private void DequeueAndProcessServerShot()
        {
            if (queuedShots.Count > 0)
            {
                QueuedShot nextShot = queuedShots.Dequeue();

                // check if we can still shoot
                PlayerMove   shooter       = nextShot.shooter.GetComponent <PlayerMove>();
                PlayerScript shooterScript = nextShot.shooter.GetComponent <PlayerScript>();
                if (!shooter.allowInput || shooterScript.IsGhost)
                {
                    Logger.Log("A player tried to shoot when not allowed or when they were a ghost.", Category.Exploits);
                    Logger.LogWarning("A shot was attempted when shooter is a ghost or is not allowed to shoot.", Category.Firearms);
                    return;
                }


                if (CurrentMagazine == null || CurrentMagazine.ServerAmmoRemains <= 0 || CurrentMagazine.containedBullets[0] == null)
                {
                    Logger.LogTrace("Player tried to shoot when there was no ammo.", Category.Exploits);
                    Logger.LogWarning("A shot was attempted when there is no ammo.", Category.Firearms);
                    return;
                }

                if (FireCountDown > 0)
                {
                    Logger.LogTrace("Player tried to shoot too fast.", Category.Exploits);
                    Logger.LogWarning("Shot was attempted to be dequeued when the fire count down is not yet at 0.", Category.Exploits);
                    return;
                }

                GameObject toShoot  = CurrentMagazine.containedBullets[0];
                int        quantity = CurrentMagazine.containedProjectilesFired[0];

                if (toShoot == null)
                {
                    Logger.LogError("Shot was attempted but no projectile or quantity was found to use", Category.Firearms);
                    return;
                }

                //perform the actual server side shooting, creating the bullet that does actual damage
                DisplayShot(nextShot.shooter, nextShot.finalDirection, nextShot.damageZone, nextShot.isSuicide, toShoot.name, quantity);

                //trigger a hotspot caused by gun firing
                shooterRegisterTile.Matrix.ReactionManager.ExposeHotspotWorldPosition(nextShot.shooter.TileWorldPosition(), 500);

                //tell all the clients to display the shot
                ShootMessage.SendToAll(nextShot.finalDirection, nextShot.damageZone, nextShot.shooter, this.gameObject, nextShot.isSuicide, toShoot.name, quantity);

                if (isSuppressed == false && nextShot.isSuicide == false)
                {
                    Chat.AddActionMsgToChat(serverHolder,
                                            $"You fire your {gameObject.ExpensiveName()}",
                                            $"{serverHolder.ExpensiveName()} fires their {gameObject.ExpensiveName()}");
                }

                //kickback
                shooterScript.pushPull.Pushable.NewtonianMove((-nextShot.finalDirection).NormalizeToInt());

                if (SpawnsCasing)
                {
                    if (casingPrefabOverride == null)
                    {
                        //no casing override set, use normal casing prefab
                        casingPrefabOverride = CustomNetworkManager.Instance.GetSpawnablePrefabFromName("BulletCasing");
                    }
                    Spawn.ServerPrefab(casingPrefabOverride, nextShot.shooter.transform.position, nextShot.shooter.transform.parent);
                }
            }
        }
示例#42
0
 void Start()
 {
     PScript = GameObject.Find("MyPlayer").GetComponent <PlayerScript> ();
 }
示例#43
0
 public void Move(TileDirection origin, PlayerScript playerTarget)
 {
     target = new PlayerTarget(playerTarget);
     TriggerMove(origin);
 }
示例#44
0
 public WallJumpingState(PlayerScript playerScript) : base(StateType.eWallJumping)
 {
     m_playerScript = playerScript;
 }
示例#45
0
 public void OnMouseDown()
 {
     PlayerScript.DownTrue();
 }
示例#46
0
 private void Start()
 {
     player = GetComponent <PlayerScript>();
 }
示例#47
0
 public void RemovePlayer(PlayerScript player)
 {
     players.Remove(player);
 }
示例#48
0
 public void OnMouseUp()
 {
     PlayerScript.DownFalse();
 }
示例#49
0
 void SpawnPlayer()
 {
     play = Instantiate(player, spawnPos, Quaternion.identity, transform.root).GetComponentInChildren <PlayerScript>();
 }
示例#50
0
    public void RunBattle()
    {
        if (!hasInitialized)
        {
            playerScript = SpawnManagerScript.Instance.playerScript;
            engagedEnemy.attrScript.RandomizeAttributes(SpawnManagerScript.Instance.playerScript.attrScript.level + (int)AttributeType.Total);

            playerScript.attrScript.InitializeBonusAttribute();
            engagedEnemy.attrScript.InitializeBonusAttribute();

            ResetState();
            hasInitialized = true;
        }

        UISubjectScript.Instance.Notify(NotificationType.Player_Health, playerScript.unitScript.health.ToString());
        UISubjectScript.Instance.Notify(NotificationType.Enemy_Health, engagedEnemy.unitScript.health.ToString());

        int startNotification = (int)NotificationType.Player_Offense;

        for (int i = 0; i < (int)AttributeType.Total; i++)
        {
            UISubjectScript.Instance.Notify((NotificationType)(startNotification + i), (playerScript.attrScript.attributeCount[i] + playerScript.attrScript.bonusAttributeCount[i]).ToString());
        }

        startNotification = (int)NotificationType.Enemy_Offense;

        for (int i = 0; i < (int)AttributeType.Total; i++)
        {
            UISubjectScript.Instance.Notify((NotificationType)(startNotification + i), (engagedEnemy.attrScript.attributeCount[i] + engagedEnemy.attrScript.bonusAttributeCount[i]).ToString());
        }

        cardPanel.gameObject.SetActive(battleState == BattleState.PlayerChoose);

        switch (battleState)
        {
        case BattleState.PlayerChoose:
            cardPanel.SpawnCards();
            if (playerAttack && cardsClicked >= 1)
            {
                battleState = BattleState.EnemyChoose;
            }
            else if (cardsClicked >= 2)
            {
                battleState = BattleState.Fight;
                timer       = 0.0f;
            }
            break;

        case BattleState.EnemyChoose:
            if (!playerAttack)
            {
                int rand = Random.Range(0, (int)AttributeType.Total);
                attackingCard = (AttributeType)rand;
                engagedEnemy.attrScript.bonusAttributeCount[rand]++;
                battleState = BattleState.PlayerChoose;
            }
            else
            {
                for (int i = 0; i < 2; i++)
                {
                    engagedEnemy.attrScript.bonusAttributeCount[Random.Range(0, (int)AttributeType.Total)]++;
                }
                battleState = BattleState.Fight;
                timer       = 0.0f;
            }
            break;

        case BattleState.Fight:

            if (timer == 0.0f)
            {
                //BATTLE
                int attackingInt  = (int)attackingCard;
                int defendingInt1 = (int)Counter(attackingCard)[0];
                int defendingInt2 = (int)Counter(attackingCard)[1];

                if (playerAttack)
                {
                    int atkDmg = playerScript.attrScript.attributeCount[attackingInt] + playerScript.attrScript.bonusAttributeCount[attackingInt];

                    int def1 = engagedEnemy.attrScript.attributeCount[defendingInt1] + engagedEnemy.attrScript.bonusAttributeCount[defendingInt1];
                    int def2 = engagedEnemy.attrScript.attributeCount[defendingInt2] + engagedEnemy.attrScript.bonusAttributeCount[defendingInt2];

                    if (def1 < atkDmg)
                    {
                        engagedEnemy.unitScript.Damage();
                    }
                    if (def2 < atkDmg)
                    {
                        engagedEnemy.unitScript.Damage();
                    }
                }
                else
                {
                    int atkDmg = engagedEnemy.attrScript.attributeCount[attackingInt] + engagedEnemy.attrScript.bonusAttributeCount[attackingInt];

                    int def1 = playerScript.attrScript.attributeCount[defendingInt1] + playerScript.attrScript.bonusAttributeCount[defendingInt1];
                    int def2 = playerScript.attrScript.attributeCount[defendingInt2] + playerScript.attrScript.bonusAttributeCount[defendingInt2];

                    if (def1 < atkDmg)
                    {
                        playerScript.unitScript.Damage();
                    }
                    if (def2 < atkDmg)
                    {
                        playerScript.unitScript.Damage();
                    }
                }
            }

            timer += Time.deltaTime;

            if (timer >= timerDuration)
            {
                if (engagedEnemy.unitScript.health <= 0)
                {
                    playerScript.LevelUp();
                    SpawnManagerScript.Instance.enemyList.Remove(engagedEnemy);
                    Destroy(engagedEnemy.gameObject);
                }
                else if (playerScript.unitScript.health <= 0 || GameManagerScript.Instance.inventory.GetItems().Count <= 0)
                {
                    GameManagerScript.Instance.curState = GameState.GameOver;
                }

                playerAttack = !playerAttack;
                ResetState();
            }
            break;
        }
    }
示例#51
0
 public virtual bool WillAffectPlayer(PlayerScript playerScript)
 {
     return(playerScript.IsGhost == false);
 }
示例#52
0
 public void OnPlayerStep(PlayerScript playerScript)
 {
     playerScript.playerHealth.AddSickness(Sickness);
 }
示例#53
0
 void Start()
 {
     displayItem  = GetComponent <DisplayItem>();
     artifacts    = GameObject.Find("PlayerShip").GetComponent <Artifacts>();
     playerScript = GameObject.Find("PlayerShip").GetComponent <PlayerScript>();
 }
示例#54
0
    //need treasure object

    void Start()
    {
        inventory    = FindObjectOfType <Inventory>();
        playerScript = FindObjectOfType <PlayerScript>();
    }
示例#55
0
 private void Awake()
 {
     playerMove   = GetComponent <PlayerMove>();
     playerScript = GetComponent <PlayerScript>();
     itemStorage  = GetComponent <ItemStorage>();
 }
 private void Awake()
 {
     playerMove   = GetComponent <PlayerMove>();
     playerScript = GetComponent <PlayerScript>();
 }
示例#57
0
 private bool IsPlayerNearby(TransformState state, out PlayerScript player)
 {
     return(IsPlayerNearby(state.WorldPosition, out player));
 }
示例#58
0
	void MakeInstance(){
		if(instance == null){
			instance = this;
		}
	}
示例#59
0
    // Start is called before the first frame update

    public void Start()
    {
        me             = new PlayerScript();
        agentRigidbody = GetComponent <Rigidbody>();
        firePoint      = transform.GetChild(2).gameObject;
    }
示例#60
0
 private void Start()
 {
     player = GameObject.Find("Player").GetComponent <PlayerScript>();
     //target = player.Head.transform;
 }