// Use this for initialization
    void Awake()
    {
        if(gameObject.name == "Player 1")
        {
            playerNum = 1;
        }
        else if (gameObject.name == "Player 2")
        {
            playerNum = 2;
        }

        if(PlayerPrefs.HasKey("Player " + playerNum + " special"))
        {
            type = PlayerPrefs.GetString("Player " + playerNum + " special");
        }

        Debug.Log (playerNum + " " + type);

        hpControl = GameObject.Find ("HealthBar " + playerNum).GetComponent<HealthController>();
        ManaBar = GameObject.Find ("ManaBar " + playerNum).GetComponent<ManaController>();

        hpControl.SetHP (3);
        //PlayerMovement pm = (PlayerMovement)gameObject.GetComponent("PlayerMovement");
        //pm.speed = setspd+2*spd;

        audio = gameObject.GetComponent<AudioPlayer>();
    }
Esempio n. 2
0
 // Use this for initialization
 void Start()
 {
     // GameObject cityStall = GameObject.Find("city_stall");
     cam = Camera.main;
     m_foodController = GameObject.Find("FoodController").GetComponent <FoodController>();
     m_manaController = GameObject.Find("ManaController").GetComponent <ManaController>();
 }
Esempio n. 3
0
    public void Start()
    {
        GameObject player = FindObjectOfType <SidescrollingPlayerControl>().gameObject;

        _health = player.GetComponent <HealthController>();
        _mana   = player.GetComponent <ManaController>();
    }
	public override bool NeedsPickup(GameObject who)
	{
		_mana = who.GetComponent<ManaController>();
		if(_mana == null)
			return false;
		
		return ! _mana.IsFull;
	}
Esempio n. 5
0
 void Awake()
 {
     BlockManager    = transform.GetComponent <BlockManager>();
     GameManager     = transform.GetComponent <GameManager>();
     TeleportManager = transform.GetComponent <TeleportManager>();
     WorldRotation   = transform.GetComponent <WorldRotation>();
     ManaController  = transform.GetComponent <ManaController>();
 }
    public override bool NeedsPickup(GameObject who)
    {
        _mana = who.GetComponent <ManaController>();
        if (_mana == null)
        {
            return(false);
        }

        return(!_mana.IsFull);
    }
Esempio n. 7
0
        public override void _Ready()
        {
            base._Ready();

            healthController     = GetNode <HealthController>("Controllers/HealthController");
            manaController       = GetNode <ManaController>("Controllers/ManaController");
            inventoryController  = GetNode <InventoryController>("Controllers/InventoryController");
            groundItemController = GetNode <GroundItemController>("Controllers/GroundItemController");

            playerInputController = GetInputController() as PlayerInputController;
        }
Esempio n. 8
0
    public void Awake()
    {
        _maestro    = Maestro.Instance;
        _controls   = ControlManager.Instance;
        _characters = CharacterManager.Instance;

        // Acquire mana system, so that we can tell spells to consume mana charges.
        GameObject playerCharacter = GameObject.FindGameObjectWithTag("Player");

        _mana = playerCharacter.GetComponent <ManaController>();

        _spellInterface  = GetComponentInChildren <SpellCastingPresenter>();
        _targetPresenter = GetComponentInChildren <SpellTargetingPresenter>();
    }
Esempio n. 9
0
 //Start Method
 private void Start()
 {
     cursorChangerController = this.GetComponent <CursorChangerController>();
     spellEffectController   = this.GetComponent <SpellEffectController>();
     manaController          = this.GetComponent <ManaController>();
     screenShakeController   = this.GetComponent <ScreenShakeController>();
     devourerController      = this.GetComponent <DevourerController>();
     screenFlashController   = this.GetComponent <ScreenFlashController>();
     corruptionController    = this.GetComponent <CorruptionController>();
     environmentController   = this.GetComponent <EnvironmentController>();
     conditionController     = this.GetComponent <ConditionController>();
     grimmoireController     = this.GetComponent <GrimmoireController>();
     enemySpawner            = this.GetComponent <EnemySpawner>();
     soundController         = this.GetComponent <SoundController>();
 }
Esempio n. 10
0
    public static ManaController Create(Player player, Vector3 manaPosition, bool displayCrystals)
    {
        GameObject manaObject = new GameObject("ManaController");

        manaObject.transform.ChangeParentAt(player.transform, manaPosition);
        manaObject.transform.localScale = Vector3.one * 0.75f;

        ManaController manaController = manaObject.AddComponent <ManaController>();

        manaController.Player          = player;
        manaController.DisplayCrystals = displayCrystals;

        manaController.UpdateSprites();
        manaController.UpdateNumbers();

        return(manaController);
    }
    // Update is called once per frame
    void Update()
    {
        if(playerNum == 0)
        {
            playerNum = gameObject.transform.parent.gameObject.GetComponent<PlayerMovement>().playerNum;
            ManaBar = GameObject.Find ("ManaBar " + playerNum).GetComponent<ManaController>();
            type = gameObject.transform.parent.gameObject.GetComponent<PlayerStats>().type;
        }
        if(/*Input.GetButtonDown("Player " + playerNum + " Shoot")*/ shoot)
            Fire ();
        //else if(Input.GetButtonDown("Player " + playerNum + " Special")&& ManaBar.GetCurrMP() > 0 && type == "A")
            //Special ();
        /*else if(Input.GetButtonDown("Player " + playerNum + " Special") && ManaBar.GetCurrMP() > 10 && type == "S"){
            if(Vector3.Distance(player.transform.position,planet.transform.position) <= 10){
            Vector3 up = planet.transform.position - transform.position;
            Vector3 targetPosition = player.transform.position - up.normalized*orbit.orbitHeight;
            player.transform.position = targetPosition;
                ManaBar.AdjustCurrMP(-0.5f);
                ManaBar.regenMode = false;
            //Debug.Log (Vector3.Distance(player.transform.position,planet.transform.position));}
            }
        }*/

            else if(/*Input.GetButton("Player " + playerNum + " Special")*/ special && ManaBar.GetCurrMP() > 0 && type == "S"){
                if(ManaBar.GetCurrMP() <= 5){

                    g.enabled = true;
                    orbit.enabled = false;
                }
                else{
                    if(timer <= 0 && !orbitNow)
                    {
                        if(Vector3.Distance(player.transform.position,planet.transform.position) <= 10){
                            Vector3 up = planet.transform.position - transform.position;
                            Vector3 targetPosition = player.transform.position - up.normalized*orbit.orbitHeight;
                            player.transform.position = targetPosition;
                            ManaBar.AdjustCurrMP(-0.5f);
                            ManaBar.regenMode = false;
                            orbitNow = true;
                        }

                    }
                if(orbitNow){
                    if(!audio.source.isPlaying)
                        audio.PlayAudio (8);
                    g.enabled = false;
                    orbit.enabled = true;
                    ManaBar.AdjustCurrMP(-1.5f);
                }
            }
            timer -= Time.deltaTime;
        }
        else if(/*Input.GetButtonUp("Player " + playerNum + " Special")*/ !special && ManaBar.GetCurrMP() > 0 && type == "S"){
            if(audio.source.clip == audio.audio[8])
            {
                audio.source.Stop();
            }
            g.enabled = true;
            orbit.enabled = false;
            ManaBar.regenMode = true;
            orbitNow = false;
            timer = tm;
        }
        if(/*Input.GetButton("Player " + playerNum + " Special")*/ special && ManaBar.GetCurrMP() > 0 && type == "D"){
            transform.FindChild("Shield").gameObject.SetActive(true);
        }
        else{
            transform.FindChild("Shield").gameObject.SetActive(false);

        }
    }
Esempio n. 12
0
 void Start()
 {
     manaController = GameInstance.Instance.manaController;
 }
	public void Start()
	{
		GameObject player = FindObjectOfType<SidescrollingPlayerControl>().gameObject;
		_health = player.GetComponent<HealthController>();
		_mana = player.GetComponent<ManaController>();
	}
 public void Init(HealthController healthController, ManaController manaController)
 {
     healthBar.Init(healthController);
     manaBar.Init(manaController);
 }
    public override void Initialize(GameObject playerCharacter)
    {
        ManaController _player = playerCharacter.GetComponent <ManaController>();

        UpdateImage(_player.Mana.MP, _player.Mana.MaxMP);
    }