Exemplo n.º 1
0
 private void Awake()
 {
     bar            = transform.GetComponentInChildren <Image>();
     movement       = GameObject.Find("Player").GetComponent <CMovement>();
     bar.fillAmount = 0;
     gameObject.SetActive(false);
 }
Exemplo n.º 2
0
    public override void Awake()
    {
        base.Awake();
        settings = new ES3Settings(ES3.EncryptionType.AES);

        if (ES3.KeyExists("IsContinue", "Stage.es3"))
        {
            if (ES3.Load <bool>("IsContinue", "Stage.es3"))
            {
                this.StageLoadData();
            }

            else
            {
                this.NotSaveChpaterEnter();
            }
        }

        else
        {
            this.NotSaveChpaterEnter();
        }

        player = FindObjectOfType <CMovement>();
        portal = this.transform.Find("Portal").GetComponent <CPortal>();
        portal.SetChapterScene(this);
        this.MoveStage();
    }
    public override void Awake()
    {
        base.Awake();
        animator            = this.GetComponent <Animator>();
        this.fCurrentHealth = this.fStartHealth;
        movement            = this.GetComponent <CMovement>();
        shooter             = this.GetComponent <CShooter>();
        this.flashTime      = 0.25f;

        if (ES3.KeyExists("CurrentHealth", "Player.es3"))
        {
            fCurrentHealth = ES3.Load <float>("CurrentHealth", "Player.es3");
            fMaxHealth     = ES3.Load <float>("MaxHealth", "Player.es3");
            shield         = ES3.Load <int>("Shield", "Player.es3");
        }

        else
        {
            ES3.Save <int>("Shield", shield, "Player.es3");
            ES3.Save <float>("CurrentHealth", fCurrentHealth, "Player.es3");
            ES3.Save <float>("MaxHealth", fMaxHealth, "Player.es3");
        }

        heartUI = GameObject.Find("Heart_UI").GetComponent <CHeartUI>();
        heartUI.SetHeart((int)fCurrentHealth, (int)fMaxHealth, shield);
        onDeath += EndGame;
    }
        internal override void FixedUpdate()
        {
            int[] entities = GetEntitiesWithComponents(typeof(CMovement), typeof(CTransform));

            foreach (int eID in entities)
            {
                CMovement  cMovement  = GetComponent <CMovement>(eID);
                CTransform cTransform = GetComponent <CTransform>(eID);

                if (HasComponent <CRigidbody>(eID))
                {
                    CRigidbody cRigidbody = GetComponent <CRigidbody>(eID);
                    if (cRigidbody.RigidBody.isKinematic == false)
                    {
                        cRigidbody.RigidBody.AddForce(cMovement.VelocityX, cMovement.VelocityY, cMovement.VelocityZ, ForceMode.VelocityChange);
                    }
                    else
                    {
                        Vector3 newPos = cRigidbody.RigidBody.position + new Vector3(cMovement.VelocityX, cMovement.VelocityY, cMovement.VelocityZ);
                        cRigidbody.RigidBody.MovePosition(newPos);
                    }
                }
                else
                {
                    cTransform.GameObject.transform.Translate(cMovement.VelocityX, cMovement.VelocityY, cMovement.VelocityZ);
                }

                cMovement.VelocityX = 0;
                cMovement.VelocityY = 0;
                cMovement.VelocityZ = 0;
            }
        }
Exemplo n.º 5
0
    void Update()
    {
        if (delay.Over())
        {
            delay.Start();
            //Wait for frequency

            foreach (DissolveEffect dissolve in dissolvedMeshes)
            {
                dissolve.Constitute();
            }
            dissolvedMeshes.Clear();

            CMovement playerMove = Cache.Get.player.GetComponent <CMovement>();
            if (!playerMove.IsInside())
            {
                return;
            }

            RaycastHit[] hits;
            hits = Physics.RaycastAll(cam.position, playerMove.transform.position - cam.position, Vector3.Distance(playerMove.transform.position, cam.position));

            for (int i = 0; i < hits.Length; i++)
            {
                RaycastHit     hit          = hits[i];
                DissolveEffect dissolveMesh = hit.transform.GetComponent <DissolveEffect>();

                if (dissolveMesh)
                {
                    dissolveMesh.Dissolve();
                    dissolvedMeshes.Add(dissolveMesh);
                }
            }
        }
    }
Exemplo n.º 6
0
    public virtual void Init(CUnit unit)
    {
        if (unit == null)
        {
            return;
        }

        m_unit = unit;


        m_rBody     = GetComponent <Rigidbody>();
        m_detectCol = GetComponent <Collider>();

        m_movement = GetComponent <CMovement>();
        m_anim     = GetComponentInChildren <Animator>();
        if (m_anim != null)
        {
            m_anim.applyRootMotion = false;

            m_animHook = GetComponentInChildren <CAnimationHook>();
            if (m_animHook == null)
            {
                m_animHook = m_anim.gameObject.AddComponent <CAnimationHook>();
            }

            m_animHook.Init(unit, this);
        }

        CanAttack = true;
    }
Exemplo n.º 7
0
 public override void InitializeAgent()
 {
     wm             = GetComponent <WeaponManager>();
     movement       = GetComponent <CMovement>();
     health         = GetComponent <CHealth>();
     grenadeThrower = GetComponent <CGrenadeThrower>();
 }
Exemplo n.º 8
0
 protected virtual void Start()
 {
     m_status   = GetComponent <CStatus>();
     m_movement = GetComponent <CMovement>();
     m_movement.Init(this);
     m_actCtrl = GetComponent <CActionCtrl>();
     m_actCtrl.Init(this);
 }
Exemplo n.º 9
0
 void Start()
 {
     me             = GetComponent <Entity>();
     camControl     = Cache.Get.cameraController;
     movement       = me.Movement;
     touch.OnSwipe += OnSwipe;
     touch.OnTouch += OnTouch;
 }
Exemplo n.º 10
0
 public EEntity()
 {
     Sight    = new CSight();
     Movement = new CMovement
     {
         Speed = 5
     };
     SightDistance       = 5;
     LeaveCombatDistance = 10;
 }
Exemplo n.º 11
0
 public override void Awake()
 {
     base.Awake();
     CWeaponManager.Instance.ReturnLobby();
     playerMovement = GameObject.Find("Player").GetComponent <CMovement>();
     cineCamera     = GameObject.Find("CM vcam1").GetComponent <CinemachineVirtualCamera>();
     canvas         = GameObject.Find("Canvas_UI");
     skipButton     = canvas.transform.Find("SkipButton").gameObject;
     ES3.Save <int[]>("StageArray", null, "Stage.es3");
     ES3.Save <int>("CurrentIndex", -1, "Stage.es3");
     ES3.Save <bool>("IsContinue", false, "Stage.es3");
 }
Exemplo n.º 12
0
 private void OnTriggerEnter2D(Collider2D collision)
 {
     if (collision.CompareTag(KDefine.TAG_PLAYER) && bIsTradable)
     {
         player = collision.GetComponent <CMovement>();
         player.interactPopup = this;
         player.playerInput.AttackButton.ChangeInteractImage();
         if (itemNameText != null)
         {
             itemNameText.enabled = true;
         }
     }
 }
Exemplo n.º 13
0
 public void OnEnter()
 {
     playerMovement  = FindObjectOfType <CMovement>();
     gunAttackPivot  = this.transform.Find("GunAttackPivot");
     playerRigidbody = playerMovement.GetComponent <Rigidbody2D>();
     weaponCategory  = new EWeaponCategory();
     if (remainBulletString == null)
     {
         remainBulletString = new StringBuilder();
     }
     Mathf.Clamp(nCurrentBulletCount, 0, nMaxBulletCount);
     SetDamage();
 }
Exemplo n.º 14
0
 // Start is called before the first frame update
 void Start()
 {
     cMovement = GetComponent <CMovement>();
     animator  = GetComponent <Animator>();
     if (gameObject.tag == "Player")
     {
         specialSlider       = GameObject.FindWithTag("PlayerSpecial").GetComponent <Slider>();
         specialSlider.value = specialVal;
     }
     else if (gameObject.tag == "Enemy")
     {
         specialSlider       = GameObject.FindWithTag("EnemySpecial").GetComponent <Slider>();
         specialSlider.value = specialVal;
     }
 }
Exemplo n.º 15
0
        void Start()
        {
            Vector3 angles = transform.eulerAngles;

            x = angles.y;
            y = angles.x;

            // Make the rigid body not change rotation
            if (GetComponent <Rigidbody>())
            {
                GetComponent <Rigidbody>().freezeRotation = true;
            }

            targetMovement = target.GetComponent <CMovement>();
            camera         = GetComponent <Camera>();
        }
Exemplo n.º 16
0
    public void OnTriggerEnter2D(Collider2D collision)
    {
        if (collision.CompareTag(KDefine.TAG_PLAYER))
        {
            Debug.Log("포탈");
            player = collision.GetComponent <CMovement>();
            player.transform.position = transform.position;
            player.EnterPortal();

            if (this.chapterManager != null && !bIsFinal)
            {
                Invoke("MoveStage", 2f);
                CFadeInOut.Fade(2f, 2f);
            }
            else if (this.chapterManager != null && bIsFinal)
            {
                Invoke("MoveChapter", 2f);
                CFadeInOut.Fade(2f, 2f);
            }
        }
    }
Exemplo n.º 17
0
 void Awake()
 {
     particleSystem = this.GetComponent <ParticleSystem>();
     fEffectEndTime = particleSystem.main.duration + fAddTime;
     playerMovement = FindObjectOfType <CMovement>();
 }
Exemplo n.º 18
0
 void JustSpawned()
 {
     movement = GetComponent <CMovement>();
 }
Exemplo n.º 19
0
 void Start()
 {
     me       = GetComponentInParent <Entity>();
     movement = me.Movement;
 }
Exemplo n.º 20
0
 void Start()
 {
     myStartPosition = GetComponent <Transform>().position;
     playerMovement  = GameObject.Find("Player").GetComponent <CMovement>();
 }
Exemplo n.º 21
0
 private CAI AI(CStats mCStats, CBody mCBody, CMovement mCMovement, CRender mCRender, CLineOfSight mCLineOfSight)
 {
     return(new CAI(_game, mCStats, mCBody, mCMovement, mCRender, mCLineOfSight));
 }
Exemplo n.º 22
0
 private CControl Control(CBody mCBody, CStats mCStats, CMovement mCMovement, CRender mCRender)
 {
     return(new CControl(_game, mCStats, mCBody, mCMovement, mCRender));
 }
Exemplo n.º 23
0
    //private bool FaceLeft = true;

    //public float timeLeft = 2.0f;

    //private bool OnGround;

    // Use this for initialization
    void Start()
    {
        Instance = this;
    }
Exemplo n.º 24
0
 void Start()
 {
     m_CachedMovement = GameObject.Find("Player").GetComponent <CMovement>();
 }