Inheritance: MonoBehaviour
Exemple #1
0
 void Awake()
 {
     player      = GameObject.FindGameObjectWithTag("Dagda");
     playerStats = player.GetComponent <playerStats>();
     spawnPoint  = GameObject.FindGameObjectWithTag("spawnPoint");
     bubble      = GameObject.FindGameObjectWithTag("Bubble");
 }
 // Use this for initialization
 void Awake()
 {
     pickedUp = false;
     stats = player.GetComponent<playerStats>();
     support = jeep.GetComponent<supportJeep>();
     isActive = false;
 }
Exemple #3
0
    // Start is called before the first frame update
    void Start()
    {
        player = FindObjectOfType <PlayerMovement>();
        pstats = FindObjectOfType <playerStats>();

        //First the Enemy Set up
        enemyRB      = GetComponent <Rigidbody2D>();
        speed        = 5;
        startHp      = 25;
        hp           = startHp;
        currentState = EnemyState.patrol;
        //Data that will be used by the script for AI behaviour
        maxDiference  = 10;
        keepDDistance = 7;
        //Lua scripting set up
        luaScript = new Script();
        loadLua();
        luaScript.DoString(luaText);  //2 hours to realize I need this, because I took it away at one point and everything broke



        //Attacking Set up
        lrcoStart = 50;
        lrco      = lrcoStart;
        //Patrol Set up
        patrolLimit  = 20;
        pdirX        = 1; //This two will keep on changing
        pdirY        = 0; //Im just putting this values to test
        patrolTurn   = 0;
        viewDistance = 10;
    }
Exemple #4
0
 void Awake()
 {
     player   = GameObject.FindGameObjectWithTag("Dagda");
     ps       = player.GetComponent <playerStats>();
     msgPanel = GameObject.FindGameObjectWithTag("panelMensaje");
     cl       = GameObject.Find("LevelChanger").GetComponentInChildren <changelayer>();
 }
Exemple #5
0
 // Use this for initialization
 void Start()
 {
     _camera = Camera.main;
     amountToMove = Vector3.zero;
     _stats = new playerStats();
     _collider = transform.GetComponent<BoxCollider>();
 }
Exemple #6
0
 // Use this for initialization
 void Start()
 {
     playerTurn = true;
     enemyTurn  = false;
     player     = FindObjectOfType <playerScript>();
     playerExp  = FindObjectOfType <playerStats>();
 }
 // Use this for initialization
 void Awake()
 {
     eHealth = GameObject.FindGameObjectWithTag ("enemy").GetComponent<enemyHealth> ();
     pStats = GameObject.FindGameObjectWithTag ("Player").GetComponent<playerStats> ();
     chckpoint = GameObject.Find("CheckPoints");
     tut = chckpoint.GetComponent<TutorialScript>();
 }
 void Start()
 {
     rigidBody    = GetComponent <Rigidbody2D>();
     player       = GameObject.FindGameObjectWithTag("Player");
     spriteRender = player.GetComponent <SpriteRenderer>();
     playerStats  = player.GetComponent <playerStats>();
 }
Exemple #9
0
 private void Start()
 {
     rigidBody = GetComponent <Rigidbody2D>();
     player    = GameObject.Find("Player");
     stats     = player.GetComponent <playerStats>();
     StartCoroutine(DestroyOverTime());
 }
Exemple #10
0
    protected void Start()
    {
        audioSource = GetComponent <AudioSource>();

        isAlive = true;

        // Fetches CameraRigh script.
        if (GameObject.Find("CameraRig") != null)
        {
            cameraControl = GameObject.Find("CameraRig").GetComponent <CameraControl>();
            cameraControl.addPlayer(gameObject);
        }

        health = basehealth; // health is wat er later vanaf gaat als weapon damage doet

        holder         = new List <GameObject>();
        transformArray = GetComponentsInChildren <Transform>();
        for (int i = 0; i < 5; i++)
        {
            holder.Add(Instantiate(prefabArray[i], transformArray[i].position + prefabArray[i].transform.position, Quaternion.identity));
            holder[i].transform.SetParent(gameObject.transform);
        }

        legs = holder[4].GetComponent <MasterLegs>();
        legs.Construct();
        //legs.controller = GetComponent<CharacterController>();
        head = holder[1].GetComponent <MasterHead>();
        lArm = holder[2].GetComponentInChildren <MasterArm>(); // get component in children is for balloon of doom item
        rArm = holder[3].GetComponentInChildren <MasterArm>(); // get component in children is for balloon of doom item

        lArm.transform.localScale    = new Vector3(-maxArmScale, maxArmScale, maxArmScale);
        lArm.transform.localPosition = rArm.transform.localPosition - new Vector3(rArm.transform.localPosition.x * 2, 0, 0);
        rArm.transform.localScale    = new Vector3(-minArmScale, minArmScale, minArmScale);

        legs.SetTotalMass(addedMass + lArm.AddedMass() + rArm.AddedMass() + head.AddedMass());

        //Changes the transforms of the guns so the left gun is on the left, -0.5, en the right gun is on the right, 0.5);
        Transform[] tempGunsObject = holder[2].GetComponentsInChildren <Transform>();

        lArm.bulletSpawn = tempGunsObject[2];

        Transform[] tempGunsObject2 = holder[3].GetComponentsInChildren <Transform>();

        rArm.bulletSpawn = tempGunsObject2[2];

        //TODO: When we want to add more health through the other body parts, we can use this calculation.
        //health = basehealth + rArm.healthMod + lArm.healthMod + legs.healthMod + head.healthMod;

        //Changes the color of the player based on the player number

        playerStats = GameManager.instance.GetComponent <playerStats>();


        playerColor = GameManager.instance.playerColors[playerID + 1]; //Set the color of the player to the right one. 1 = blue, 2 = red etc..

        lArm.color = this.playerColor;
        rArm.color = this.playerColor;
        //sets the color of the player
        setColor(playerColor);
    }
Exemple #11
0
 void Start()
 {
     audioManager       = FindObjectOfType <AudioManager>();
     finishedMinigameUI = GetComponent <FinishedMinigameUI>();
     playerStats        = GameObject.FindGameObjectWithTag("persistentData").GetComponent <playerStats>();
     raised             = false;
 }
Exemple #12
0
 private void Awake()
 {
     if (gameObject.CompareTag("Player"))
     {
         playerStats playerStats = GameObject.FindGameObjectWithTag("persistentData").GetComponent <playerStats>();
         attack    = playerStats.attack;
         defense   = playerStats.defense;
         velocity  = playerStats.velocity;
         maxEnergy = playerStats.maxEnergy + Mathf.Floor(velocity / 35);
     }
     else
     {
         TinderData tinderData = GameObject.FindGameObjectWithTag("persistentData").GetComponent <TinderData>();
         cBase = tinderData.combatCharacter;
         int   curDay     = tinderData.curDay - 1;
         float totalStats = cBase.attack + cBase.defense + cBase.velocity;
         attack    = cBase.attack + (cBase.attack / totalStats) * curDay * tinderData.enemyStatsPerDay;
         defense   = cBase.defense + (cBase.defense / totalStats) * curDay * tinderData.enemyStatsPerDay;
         velocity  = cBase.velocity + (cBase.velocity / totalStats) * curDay * tinderData.enemyStatsPerDay;
         maxEnergy = cBase.maxEnergy + Mathf.Floor(velocity / 35);
     }
     maxHealth        = attack / 4 + defense / 2 + 2 * velocity;
     shieldsAvailable = 3 + Mathf.FloorToInt(defense / 175);
     curHealth        = maxHealth;
     curEnergy        = maxEnergy;
 }
 // Start is called before the first frame update
 void Start()
 {
     respawnPos      = transform.position;
     stats           = GetComponent <playerStats>();
     movement        = GetComponent <playerMovement>();
     lumina          = GetComponent <luminaController>();
     lastFrameHealth = stats.currentHealth;
 }
    // Use this for initialization
    void Start()
    {
        //spawnObject = this.GetComponent<GameObject>();
        //playerObject = this.GetComponent<GameObject>();
        playerStatScript = this.GetComponent <playerStats>();

        candySpawned = false;
    }
 // Use this for initialization
 void Awake()
 {
     tut = chckpoint.GetComponent<TutorialScript>();
     pickedUp = false;
     stats = player.GetComponent<playerStats>();
     support = jeep.GetComponent<supportJeep>();
     isActive = false;
 }
 // Start is called before the first frame update
 void Start()
 {
     target   = playerManager.Instance.player.transform;
     agent    = GetComponent <NavMeshAgent>();
     anim     = GetComponent <Animator>();
     ps       = gm.GetComponent <playerStats>();
     isLiving = true;
 }
 void Start()
 {
     pS           = playerStats.stats;
     anim         = GetComponent <Animator>();
     sound        = GetComponent <AudioSource>();
     anim.enabled = false;
     runeActive   = false;
     runeType     = RuneType;
 }
Exemple #18
0
    // Use this for initialization
    void Start()
    {
        anim = GetComponent <Animator>();
        x    = transform.localScale.x;
        y    = transform.localScale.y;
        z    = transform.localScale.z;

        player = FindObjectOfType <playerStats>();
    }
Exemple #19
0
 void OnTriggerEnter2D(Collider2D col)
 {
     if (col.gameObject.name == "Player")
     {
         playerStats stats = col.gameObject.GetComponent <playerStats>();
         stats.TakeDamage();
         animator.SetTrigger("Destroy");
     }
 }
Exemple #20
0
 void OnTriggerEnter2D(Collider2D col)
 {
     if (col.tag == "Player")
     {
         Debug.Log("hit");
         pS = col.gameObject.GetComponent <playerStats>();
         pS.Respawn();
     }
 }
Exemple #21
0
    /**
     * Initialisation
     *
     */
    void Start()
    {
        if (wayPoints.Length > 0)
        {
            currentWaypoint = wayPoints[0];
        }

        pS = GameObject.Find("Player").GetComponent <playerStats>();
    }
Exemple #22
0
 void Start()
 {
     rb2d            = GetComponent <Rigidbody2D>();
     boulderCollider = GetComponent <CircleCollider2D>();
     anim            = GetComponent <Animator>();
     boulderDistance = 1;
     hDirection      = 0;
     staff           = StaffController.staff;
     pS = playerStats.stats;
 }
Exemple #23
0
 void Awake()
 {
     player         = GameObject.FindGameObjectWithTag("Dagda");
     ps             = player.GetComponent <playerStats>();
     playerAnimator = GFX.transform.GetComponent <Animator>();
     maincam        = Camera.main.transform;
     disparador     = GameObject.Find("Disparador");
     shootScript    = disparador.GetComponent <Shoot>();
     burbuja        = GameObject.FindGameObjectWithTag("Bubble");
 }
Exemple #24
0
    void Start()
    {
        scroll      = scrollObject.GetComponent <ScrollSnapRect>();
        playerStats = GetComponent <playerStats>();

        if (PlayerPrefs.GetInt("carrosComprados").ToString() == "")
        {
            PlayerPrefs.SetInt("carrosComprados", 0);
        }
    }
Exemple #25
0
    playerStats pS;                                 // used for sharing attacker and victoms coins on attack


    // Use this for initialization
    new void Start()
    {
        base.Start();
        pS = GameManager.instance.GetComponent <playerStats>();

        rotatingPoint = transform.GetChild(0).gameObject;
        projectPos    = projection.transform.localPosition;
        projectRot    = projection.transform.localRotation;
        projection.transform.parent = null;
    }
    void Start()
    {
        // sets Rigidbody2D rb as the rigidbody component of the gameobject this script is attached to
        rb = this.gameObject.GetComponent <Rigidbody2D>();

        // sets playerStats ps as the playerStats script of the gameobject this script is attached to
        ps = this.gameObject.GetComponent <playerStats>();

        // sets Animator anim as the Animator component of the gameobject this script is attached to
        anim = this.gameObject.GetComponent <Animator>();
    }
 // Use this for initialization
 void Awake()
 {
     Instance = this;
     attackTime = Time.time;
     npc = GetComponent<NavMeshAgent>();
     stats = player.GetComponent<playerStats>();
     layerMask = ~layerMask;
     enemy = this.GetComponent<enemyHealth>();
     test = player.GetComponent<PlayerMove>();
     isNear = false;
     isDetected = false;
 }
Exemple #28
0
	// Use this for initialization
	void Start () {
		stats = GetComponent<playerStats> ();
		debugOn = true;
		render = playerMesh.GetComponent<Renderer> ();
		//playerNameObject.text = playerName;
		Application.runInBackground = true;
		charControl = GetComponent<CharacterController> ();
		distToGround = charControl.bounds.extents.y + 0.1f;
		cam = Camera.main;
		if (photonView.isMine && !stats.isDead()) {
			cam.GetComponent<cameraFollow> ().target = this.gameObject.transform;
		}
	}
Exemple #29
0
    private void Start()
    {
        Playstats    = GameObject.FindGameObjectWithTag("Player").GetComponent <playerStats>();
        maxFood      = Playstats.maxHunger;
        eaten        = Playstats.startHunger;
        amountOfFood = Playstats.foodPickUp;
        rate         = Playstats.hungerSpeed;

        if (GameObject.Find("PickUps") != null)
        {
            audio_pickup = GameObject.Find("PickUps").GetComponent <Audio_pickup>();
        }
    }
Exemple #30
0
    private void Start()
    {
        PlayStats  = this.gameObject.GetComponent <playerStats>();
        MaxWater   = PlayStats.maxWater;
        drink      = PlayStats.startWater;
        rate       = PlayStats.waterLossRate;
        lossAmount = PlayStats.waterLossAmount;
        //drinkAmount = PlayStats.waterPickUp;



        //audio_pickup = GameObject.Find("PickUps").GetComponent<Audio_pickup>();
    }
 // Use this for initialization
 void Awake()
 {
     //This allows this object to be the only object in existance
     if (stats == null)
     {
         DontDestroyOnLoad(gameObject);
         stats = this;
     }
     else if (stats != this)
     {
         Destroy(gameObject);
     }
 }
Exemple #32
0
    void Start()
    {
        if (!UIExists)
        {
            UIExists = true;
            DontDestroyOnLoad(transform.gameObject);
        }
        else
        {
            Destroy(gameObject);
        }

        thePS = GetComponent <playerStats>();
    }
Exemple #33
0
 void Start()
 {
     //paneles = GameObject.FindGameObjectsWithTag("Panel");
     panelStart    = GameObject.Find("panelStart");
     dagda         = GameObject.Find("Dagda");
     cameraScript  = GameObject.Find("Camera").GetComponent <CameraFollow>();
     dagdaStats    = dagda.GetComponent <playerStats>();
     dagdaControll = dagda.GetComponent <PlayerController>();
     panelOptions  = GameObject.Find("panelOptions");
     panelControll = GameObject.Find("panelControll");
     panelDeath    = GameObject.Find("panelDeath");
     background    = GameObject.Find("background");
     pauseMenu     = GameObject.Find("pauseMenu");
 }
    void setStats(string playerID)
    {
        playerStats stats = GameObject.Find(playerID).GetComponent <playerStats> ();

        Kills.GetComponent <Text>().text = stats.Kills.ToString();
        UpdateConfig("Kills", Kills.ToString());
        Deaths.GetComponent <Text>().text = stats.Deaths.ToString();
        UpdateConfig("Deaths", Deaths.ToString());
        DamageTaken.GetComponent <Text>().text = stats.DamageTaken.ToString();
        UpdateConfig("DamageTaken", DamageTaken.ToString());
        DamageDealt.GetComponent <Text>().text = stats.DamageDealt.ToString();
        UpdateConfig("DamageDealt", DamageDealt.ToString());
        BestKillSteak.GetComponent <Text>().text = stats.BestKillStreak.ToString();
        UpdateConfig("BestKillStreak", BestKillSteak.ToString());
    }
Exemple #35
0
 void Start()
 {
     rb2d = GetComponent <Rigidbody2D>();                  //reference rb2d
     staffLightningPoint = GetComponent <BoxCollider2D>(); //reference box collider
     anim            = staff.GetComponent <Animator>();    //reference animator
     moveLocation    = 0;                                  //Default 0
     strikePoint     = 0;                                  //Default 0
     hDirection      = 0;                                  //Default 0, 1 is right, -1 is left
     strikeBounds    = 0;                                  //Default 0
     strikeState     = false;
     pS              = playerStats.stats;
     RuneScriptSpeed = RuneScriptSpeed.rune;
     runeMultiplyer  = pS.runeMultiplyerSpeed;
     sound           = GetComponent <AudioSource>();
 }
 protected void ObjectComponents()
 {
     rb2d            = GetComponent <Rigidbody2D>();
     spriteRend      = GetComponent <SpriteRenderer>();
     boulder         = boulderController.boulder;
     timeRune        = RuneScriptTime.rune;
     boulderCollider = boulder.GetComponent <CircleCollider2D>();
     selfCollider    = GetComponent <BoxCollider2D>();
     anim            = GetComponent <Animator>();
     pS           = playerStats.stats;
     hDirection   = 0;
     dropRotation = new Quaternion(transform.rotation.x, transform.rotation.y, 0, transform.rotation.w);
     wetGrav      = 2;
     wet          = false;
 }
 // Use this for initialization
 void Start()
 {
     show = gameObject.GetComponent<Text>();
     statsss = _Gm.GetComponent<playerStats>();
 }
 public static void Load(playerStats saveGame)
 {
     current.stats = saveGame;
     gameloaded = true;
 }
 // Use this for initialization
 void Start()
 {
     show = transform.parent.gameObject.GetComponent<Text>();
     statsss = _Gm.GetComponent<playerStats>();
 }
Exemple #40
0
 public static string StartNewGame(string playerName, string playerGender, string playerClass, string xmlFile)
 {
     playerStats baseStats = new playerStats(playerClass, playerGender);
     gameData = new GameData.GameInformation(loadLocationData(xmlFile), loadItemData(xmlFile), playerName, playerGender, playerClass, 0, baseStats, 0);
     gameData.loadGameInfo(xmlFile);
     GUI_Terminal.consoleLog = "";
     GUI_Terminal.ScrollPosition = new Vector2(0,0);
     Inventory.updateInventory();
     WorldMoves.initEnemyList();
     return "\n<<Game Started>>\n\n" + gameData.IntroText + "\n\n" + gameData.Locations[0].getDescription();
 }
Exemple #41
0
 public GameInformation(List<LocationData.Location> locations, List<ItemData.Item> items, string playerName, string playerGender, string playerClass, int currentLoc, playerStats stats, int turn)
 {
     this.locations = locations;
     this.items = items;
     this.playerName = playerName;
     this.playerGender = playerGender;
     this.playerClass = playerClass;
     this.currentLoc = currentLoc;
     this.stats = stats;
     this.turn = turn;
 }
 // Use this for initialization
 void Awake()
 {
     bsmokeScreen = false;
     i = 0;
     Instance = this;
 }
 void Start()
 {
     stats = new playerStats(equipment);
     Loot.Add(new Item("crown", 0, 2, SlotType.head, true));
     Loot.Add(new Item("lantern", 0, 0, SlotType.dagger, true));
     Loot.Add(new Item("shortsword", 3, 0, SlotType.sword, false));
     Loot.Add(new Item("armor", 0, 5, SlotType.armor, false));
     Loot.Add(new Item("longsword", 5, 1, SlotType.sword, false));
 }