コード例 #1
0
 public bool UpgradeTurret(ref PlayerRessources ressources)
 {
     if (this.state < 2)
     {
         if (this.state == 0 && ressources.beer > 0)
         {
             this.state++;
             ressources.beer--;
             this.GetComponent <SpriteRenderer>().sprite = this.barrel;
             return(true);
         }
         if (this.state == 1 && ressources.civilian > 0)
         {
             // Deux façons d'écrire un nombre à virgules
             //double d = 0.5;
             //float f = 0.5f;
             this.state++;
             ressources.civilian--;
             Instantiate(towerPrefab, this.transform.position + new Vector3(0.05f, 0.25f, 0), Quaternion.identity, this.transform);
             return(true);
         }
         return(false);
     }
     return(false);
 }
コード例 #2
0
    private void Init(PlayerRessources PR)
    {
        PLayer_Stats.AudioS          = GetComponent <AudioSource>();
        PLayer_Stats.AudioSFootSteps = footSteps;
        PLayer_Stats.Anim            = GetComponent <Animator>();


        //Grenade
        PLayer_Stats.ThrowedGrened     = null;
        PLayer_Stats.handAttachGrenade = SoldierHand;
        PLayer_Stats.GrenadePrefab     = PR.GrenadePrefab;
        PLayer_Stats.HealPs            = PR.HealPs;


        //AudioClips
        PLayer_Stats.pickup         = PR.pickup;
        PLayer_Stats.ReloadingSound = PR.ReloadingSound;
        PLayer_Stats.Shooting       = PR.ShootingClip;
        PLayer_Stats.healSound      = PR.healClip;
        PLayer_Stats.FootStep       = PR.FootStepsClip;


        //Firing
        PLayer_Stats.bullet       = PR.bullet;
        PLayer_Stats.Casingbullet = PR.Casingbullet;



        playermanager = GetComponent <PlayerManager>();
        playermanager.updateAmmo();
    }
コード例 #3
0
 protected override void Awake()
 {
     base.Awake();
     ressources = new PlayerRessources();
     playing    = true;
 }