예제 #1
0
    public void SystemUpdate()
    {
        double angle = 90;
        TAccessor <CircleModule> movAccessor = TAccessor <CircleModule> .Instance();

        foreach (var module in movAccessor.GetAllModule())
        {
            GameObject myEntity = module.gameObject;
            angle *= Math.PI / 180;

            float xO = module.pwayer.position.x;
            float zO = module.pwayer.position.z;

            float xM = myEntity.transform.position.x - xO;
            float zM = myEntity.transform.position.z - zO;

            float X = (float)((xM * Math.Cos(angle)) + (zM * Math.Sin(angle)) + xO);
            float Z = (float)((-xM * Math.Sin(angle)) + (zM * Math.Cos(angle)) + zO);

            Debug.Log("X : " + X);
            Debug.Log("Z : " + Z + " le z");
            Debug.Log("Angle : " + angle);

            Vector3 move = new Vector3(X, 0, Z) * Time.deltaTime;

            myEntity.transform.Translate(move);
        }
    }
예제 #2
0
    public void SystemUpdate()
    {
        TAccessor <BulletMov> movAccessor = TAccessor <BulletMov> .Instance();

        foreach (var module in movAccessor.GetAllModule())
        {
            GameObject myEntity = module.gameObject;
            Vector3    move     = new Vector3(0, 0, module.Speed) * Time.deltaTime;
            myEntity.transform.Translate(move);
        }
    }
예제 #3
0
    public void SystemUpdate()
    {
        TAccessor <BulletModule> BulAccessor = TAccessor <BulletModule> .Instance();

        foreach (var module in BulAccessor.GetAllModule())
        {
            if (Input.GetKeyDown("space"))
            {
                GameObject myEntity   = module.gameObject;
                Vector3    V          = new Vector3(myEntity.transform.position.x, myEntity.transform.position.y, myEntity.transform.position.z + 0.5f);
                var        tempBullet = UnityEngine.Object.Instantiate(module.Bullet, V, myEntity.transform.rotation);
                UnityEngine.Object.Destroy(tempBullet, 5);
            }
        }
    }
예제 #4
0
    public void SystemUpdate()
    {
        TAccessor <MovementModule> movAccessor = TAccessor <MovementModule> .Instance();

        foreach (var module in movAccessor.GetAllModule()) //gère les mouvement appliquer par le joueur pour manipuller une a plusieur entité a la foix
        {
            GameObject myEntity = module.gameObject;

            float inputX = Input.GetAxis("Horizontal");
            float inputY = Input.GetAxis("Vertical");

            Vector3 move = new Vector3(module.Speed * inputX, 0, module.Speed * inputY) * Time.deltaTime;

            myEntity.transform.Translate(move);
        }
    }