コード例 #1
0
 void Start()
 {
     boxClollider           = gameObject.AddComponent <BoxCollider>();
     boxClollider.isTrigger = false;
     chScript = gameObject.AddComponent <CollisionHandler>();
     dpScript = gameObject.AddComponent <DeathProtocol>();
     hcScript = gameObject.AddComponent <HealthContainer>();
 }
コード例 #2
0
ファイル: UIProfile.cs プロジェクト: rellfy/PPSDemo
    public UIProfile(GameObject gameObject) : base(gameObject)
    {
        UIReferencing referencing = gameObject.GetComponent <UIReferencing>();

        this.localScore            = referencing.localScore;
        this.localScore.label.text = "YOUR SCORE";
        this.enemyScore            = referencing.enemyScore;
        this.healthContainer       = referencing.healthContainer;

        Object.DestroyImmediate(referencing);
    }
コード例 #3
0
    public void InitializePlayer()
    {
        Init();
        transform.position = new Vector3(0, -GameController.instance.GetComponent <SheetAssigner>().verticalOffset / 5.4f, 0);

        // Stats
        maxHP              = 10;
        hp                 = 3;
        damage             = 5;
        speed              = 1;
        fireRate           = 15.0f;
        projectileCooldown = false;
        isHit              = false;
        knockback          = false;
        firing             = false;
        projectileSpeed    = 10.0f;
        heartContainer     = GameController.instance.uiCanvas.GetChild(0).Find("HealthContainer").GetComponent <HealthContainer>();

        UpdateHealthDisplay();
        GameController.instance.singletons.Add(this.gameObject);
    }
コード例 #4
0
 public virtual void Awake()
 {
     _rigidbody       = GetComponent <Rigidbody2D>();
     _healthContainer = GetComponent <HealthContainer>();
 }
コード例 #5
0
 public static HealthContainerWrapper Wrap(HealthContainer healthContainer) => new HealthContainerWrapper
 {
     HealthContainer = healthContainer
 };
コード例 #6
0
        public StateContainer(GameState state, IEnumerable <IStateObserver> observers, HealthContainer healthContainer)
        {
            _state         = state;
            _reactiveState = new ReactiveProperty <GameState>(_state);
            foreach (var stateObserver in observers)
            {
                stateObserver.SubscribeTo(_reactiveState);
            }

            healthContainer.SubscribeTo(_reactiveState);
        }
コード例 #7
0
 private void Awake()
 {
     _strenth  = GetComponent <HealthContainer>();
     isExplode = false;
 }