상속: MonoBehaviour
예제 #1
0
    //bool timeThrough = false;


    // Start is called before the first frame update
    void Start()
    {
        phases.Add(0);
        phases.Add(1);
        phases.Add(2);
        phases.Add(3);
        phase    = GameObject.Find("HealthBar").GetComponent <healthBar>();
        princess = GameObject.Find("_princess");
        random   = Random.Range(0, phases.Count);
        phases.RemoveAt(random);

        random = 3;
        if (random == 0f)
        {
            InvokeRepeating("Fire", 2.0f, 1.5f);
        }
        else if (random == 1)
        {
            InvokeRepeating("SpawnARocket", 2f, 2.5f);
        }
        else if (random == 2)
        {
            InvokeRepeating("CloudSpawning", 2f, 3f);

            InvokeRepeating("laser", 4f, 8f);
        }
        else if (random == 3)
        {
            InvokeRepeating("balloon", 2f, 2f);
            InvokeRepeating("hat", 2f, 1f);
        }
    }
예제 #2
0
 void Awake()
 {
     bndCheck  = GetComponent <BoundsCheck>();
     bar       = GameObject.Find("HealthBar");
     healthbar = bar.GetComponent <healthBar>();
     healthbar.setSize(1f);
 }
    // Use this for initialization
    void Start()
    {
        //setting our current state to alive
        m_eCurrentPlayerState = E_PLAYER_STATE.E_PLAYER_STATE_ALIVE;

        verticalAxis   = "_Vertical";
        horizontalAxis = "_Horizontal";
        rotationAxisX  = "_Rotation_X";
        rotationAxisY  = "_Rotation_Y";
        Fire           = "_Fire";
        Throw          = "_Throw";
        Jump           = "_Jump";

        // Loops through our players and assigns variables for input from different controllers
        for (uint i = 0; i < MAX_PLAYERS; ++i)
        {
            if (m_playerID == i)
            {
                verticalAxis   = "P" + (i + 1) + verticalAxis;   //"_Vertical";
                horizontalAxis = "P" + (i + 1) + horizontalAxis; // "_Horizontal";
                rotationAxisX  = "P" + (i + 1) + rotationAxisX;  // "_Rotation_X";
                rotationAxisY  = "P" + (i + 1) + rotationAxisY;  // "_Rotation_Y";
                Fire           = "P" + (i + 1) + Fire;
                Throw          = "P" + (i + 1) + Throw;
                Jump           = "P" + (i + 1) + Jump;
            }
        }

        healthBars = FindObjectOfType <healthBar> ();

        animator = GetComponentInChildren <Animator> ();
    }
예제 #4
0
    void Awake()
    {
        //animator = GetComponent<Animator>();
        //healthBarObject = GetComponent<GameObject>();
        healthBar = healthBarObject.GetComponent <healthBar>();
        //laser = GetComponent<GameObject>();
        laserRB    = laser.GetComponent <Rigidbody2D>();
        laserPoint = GameObject.Find("LaserPoint");

        laserScript = laser.GetComponent <laser>();
        player      = GameObject.Find("PlayerPivot");

        healthBarObject.SetActive(false);

        anubisRoar = GetComponent <AudioSource>();

        RageMetre = GameObject.Find("RageMeter");

        rageMetreScript = RageMetre.GetComponent <rageMeterScript>();

        areaAttack.SetActive(false);

        laserEye.SetActive(false);

        areaAttacks.SetActive(false);

        //areaAttack = GetComponent<GameObject>();
        //laserScript.enabled = false;

        health = RageMetre.transform.localScale.x;

        RageMetre.SetActive(false);
    }
예제 #5
0
    public bool inFire = false;                             //creates bool to see if player if still in the fire


    private void Awake()
    {
        HealthBar = FindObjectOfType <healthBar>();          //finds object within scene as defined by healthbar
        //if (HealthBar)                                      //debugs whether it is discovered or not
        //    Debug.Log("Health bar is found!!");
        //else
        //    Debug.Log("Not found, try again!!");
    }
예제 #6
0
 void OnCollisionEnter(Collision other)
 {
     if (other.gameObject.name == "JakMan") {
         Destroy (this.gameObject);
         //Instantiate (exp, transform.position, Quaternion.identity);
         health = other.gameObject.GetComponent<healthBar>();
         health.Life++;
     }
 }
예제 #7
0
    void OnCollisionEnter(Collision other)
    {
        if (other.gameObject.name == "JakMan") {
            health = other.gameObject.GetComponent<healthBar>();
            health.Life--;
            other.transform.position = health.startPos;
            this.transform.position = enemyStart;

        }
    }
예제 #8
0
    IEnumerator OnCollisionEnter(Collision other)
    {
        if (other.gameObject.name == "JakMan") {
            yield return StartCoroutine(MyWaitFunction (0.0255f));
            health = other.gameObject.GetComponent<healthBar>();
            health.Life--;
            other.transform.position = health.startPos;

        }
    }
예제 #9
0
 // Use this for initialization
 void Start()
 {
     GM         = GameObject.Find("GM");
     health     = GM.GetComponent <GameObjectHolder>().HealthAndCurrency.GetComponent <healthBar>();
     formData   = GM.GetComponent <sendDataToForm>();
     pathHolder = gameObject.GetComponent <mapTraversal>();
     renderers  = GetComponentsInChildren <Transform>(true);
     renderers[1].gameObject.SetActive(true);
     locationsVisited = new Stack <string>();
     redsPassed       = new Stack <string>();
     orangesPassed    = new Stack <string>();
 }
예제 #10
0
    public Creature(GameObject prefab, int x, int y, int maxActionPoints, int team, int maxHealth = 10, int attackDamage = 1, int attackRange = 1, int defenseHeal = 10, int defenseResistance = 10, int dodge = 10)
    {
        this.x                 = x;
        this.y                 = y;
        this.team              = team;
        this.maxActionPoints   = maxActionPoints;
        this.attackRange       = attackRange;
        this.maxHealth         = maxHealth;
        this.health            = maxHealth;
        this.attackDamage      = attackDamage;
        this.defenseHeal       = defenseHeal;
        this.defenseResistance = defenseResistance;
        this.dodge             = dodge;

        this.terrain          = Terrain.allTiles[y][x];
        this.terrain.creature = this;
        this.spriteInstance   = MonoBehaviour.Instantiate(prefab);
        this.spriteInstance.transform.localScale = new Vector3(0.5f, 0.5f, 0.5f);
        this.spriteInstance.transform.position   = this.terrain.spriteInstance.transform.position + new Vector3(0, 0, -0.0001f);

        var hpTransform = spriteInstance.GetComponentsInChildren <Transform>();
        var hpScale     = hpTransform[1].localScale;

        hpTransform[1].localScale = new Vector3(hpScale.x * Terrain._terrainSize * 1.3f, hpScale.y * Terrain._terrainSize * 1.3f, hpScale.z * Terrain._terrainSize * 1.3f) * 13;

        this.hp_bar = this.spriteInstance.GetComponent <healthBar>();

        this.actionPoints = maxActionPoints;
        allCreatures.Add(this);

        for (int aux = 0; aux < this.skills.Length; aux++)
        {
            this.skills[aux] = null;
        }

        buffs = spriteInstance.GetComponent <BuffsControl>();
        if (this.terrain is Forest)
        {
            buffs.add_buff("Floresta");
        }
        if (this.terrain is River)
        {
            buffs.add_buff("Rio");
        }
        if (this.terrain is Fortress)
        {
            buffs.add_buff("Fortaleza");
        }
    }
예제 #11
0
    void Start()
    {
        jumpy = GameObject.Find("jump").GetComponent <AudioSource>();
        firey = GameObject.Find("shoot").GetComponent <AudioSource>();
        land  = GameObject.Find("landing").GetComponent <AudioSource>();
        gem   = GameObject.Find("gemGrab").GetComponent <AudioSource>();
        pop   = GameObject.Find("pop").GetComponent <AudioSource>();
        waits = GameObject.Find("HealthBar").GetComponent <healthBar>();
        //reset the weapons to start _Hero with 1 blaster
        GameObject sprite = GameObject.Find("princessSprite");

        anim = sprite.GetComponent <Animator>();
        ClearWeapons();
        weapons[0].SetType(WeaponType.blaster);
    }
예제 #12
0
 void Start()
 {
     GM               = GameObject.Find("GM");
     stepCounter      = 0;
     success          = false;
     pathData         = new Stack <string>();
     correctPath      = new Stack <string>();
     attackerIdentity = gameObject.GetComponent <identityHandler>();
     healthCTRL       = GM.GetComponent <GameObjectHolder>().HealthAndCurrency;
     gameHealth       = healthCTRL.GetComponent <healthBar>();
     dataHandler      = GM.GetComponent <sendDataToForm>();
     currentMap       = GM.GetComponent <Graph>();
     setRandomID();
     next = currentMap.getStartingPath(transform.position);
     Debug.Log(next);
 }
예제 #13
0
 //Vector3 laserPointPosition;
 // Vector3 beginPos;
 void Start()
 {
     pop = GameObject.Find("pop").GetComponent <AudioSource>();
     dinoWeaponScript = GameObject.Find("dinoWeapon").GetComponent <dinoWeapon>();
     healthScript     = GameObject.Find("HealthBar").GetComponent <healthBar>();
     healthScript.roaring();
     princesss      = GameObject.Find("_princess");
     laserPoint     = dinoWeaponScript.newPoint;
     princessScript = princesss.GetComponent <hero>();
     lr             = GetComponent <LineRenderer>();
     lr.SetPosition(0, transform.position);
     //birthtime = Time.time;
     Destroy(laserPoint, 4f);
     Destroy(gameObject, 4f);
     //beginPos = transform.position;
     //laserPointPosition = laserPoint.transform.position;
 }
예제 #14
0
    void Start()
    {
        sprender = player.GetComponent <SpriteRenderer>();
        if (instance == null)
        {
            instance = this;
        }

        invis = false;
        if (GameObject.Find("BossHP") != null)
        {
            GameObject.Find("BossHP").SetActive(true);
        }
        step   = image.fillAmount / Maxhealth;
        health = Maxhealth;
        hpui.SetActive(true);
        coinui.SetActive(true);
        //rb = player.GetComponent<Rigidbody2D>();
        objCollider  = player.GetComponent <BoxCollider2D>();
        circCollider = player.GetComponent <CircleCollider2D>();
    }
예제 #15
0
 public void Start()
 {
     recieveDamage = true;
     anim          = GetComponent <Animator>();
     hb            = GameObject.Find("Cube").GetComponent <healthBar>();
 }
예제 #16
0
 public void Start()
 {
     hb = GameObject.Find("Cube").GetComponent <healthBar>();
 }
예제 #17
0
 private void Awake()
 {
     Instance = this;
 }