Beispiel #1
0
        public void Draw(PrimManager PrimManager, Vector3 BottomLeft, float Size)
        {
            Vector3 MasterBottomLeftFront = BottomLeft;
            Vector3 MasterTopRightBack    = MasterBottomLeftFront + new Vector3(Size, Size, Size);

            Vector3 topLeftFront     = new Vector3(MasterBottomLeftFront.X, MasterBottomLeftFront.Y, MasterTopRightBack.Z);
            Vector3 bottomLeftFront  = MasterBottomLeftFront;
            Vector3 topRightFront    = new Vector3(MasterTopRightBack.X, MasterBottomLeftFront.Y, MasterTopRightBack.Z);
            Vector3 bottomRightFront = new Vector3(MasterTopRightBack.X, MasterBottomLeftFront.Y, MasterBottomLeftFront.Z);
            Vector3 topLeftBack      = new Vector3(MasterBottomLeftFront.X, MasterTopRightBack.Y, MasterTopRightBack.Z);
            Vector3 bottomLeftBack   = new Vector3(MasterBottomLeftFront.X, MasterTopRightBack.Y, MasterBottomLeftFront.Z);
            Vector3 topRightBack     = MasterTopRightBack;
            Vector3 bottomRightBack  = new Vector3(MasterTopRightBack.X, MasterTopRightBack.Y, MasterBottomLeftFront.Z);

            Vector3 frontNormal  = new Vector3(0.0f, -1.0f, 0.0f);
            Vector3 backNormal   = new Vector3(0.0f, 1.0f, 0.0f);
            Vector3 topNormal    = new Vector3(0.0f, 0.0f, 1.0f);
            Vector3 bottomNormal = new Vector3(0.0f, 0.0f, -1.0f);
            Vector3 leftNormal   = new Vector3(-1.0f, 0.0f, 0.0f);
            Vector3 rightNormal  = new Vector3(1.0f, 0.0f, 0.0f);

            VertexIndexData _returnData = new VertexIndexData();

            _returnData.AddData(PrimHelper.GenerateWallVertices(bottomLeftFront, topRightFront, frontNormal, TilesetMain.Tiles[Tex[0]]));

            _returnData.AddData(PrimHelper.GenerateWallVertices(bottomRightBack, topLeftBack, backNormal, TilesetMain.Tiles[Tex[2]]));
            _returnData.AddData(PrimHelper.GenerateWallVertices(bottomLeftBack, topLeftFront, leftNormal, TilesetMain.Tiles[Tex[3]]));

            _returnData.AddData(PrimHelper.GenerateWallVertices(bottomRightFront, topRightBack, rightNormal, TilesetMain.Tiles[Tex[1]]));

            _returnData.AddData(PrimHelper.GenerateFloorVertices(bottomLeftBack, bottomRightFront, bottomNormal, TilesetMain.Tiles[Tex[4]]));
            _returnData.AddData(PrimHelper.GenerateFloorVertices(topLeftFront, topRightBack, topNormal, TilesetMain.Tiles[Tex[5]]));

            PrimManager.DrawVertices(_returnData, TilesetMain.TextureMain);
        }
        public PrimManager GetPrimManager(UUID user)
        {
            PrimManager pm;

            if (!lookup.TryGetValue (user, out pm)) {
                pm = new PrimManager (scene);
                lookup.Add (user, pm);
            }

            return pm;
        }
Beispiel #3
0
    //ATAQUE
    public void Attack()
    {
        Debug.Log(wannaTalk);
        if (wannaTalk)
        {
            wannaTalk = false;
            npcToTalk.awakeConversationMethods();
            return;
        }
        if (!canAttack)
        {
            return;
        }

        if (!mySource.isPlaying)
        {
            mySource.PlayOneShot(attackClip);
        }
        anim.SetTrigger("attack");
        //Activate particle
        instanceFromOrientation(attackParticles, .2f);

        Collider2D[] enemigos = Physics2D.OverlapCircleAll(attackZone.transform.position, range, enemyLabel);
        for (int i = 0; i < enemigos.Length; i++)
        {
            enemigos[i].GetComponent <Enemy>().takeDamage(this.getAttack(), zoneLoc, thrust);
        }

        //Para el puzzle de electricidad y Prim
        Collider2D[] cables = Physics2D.OverlapCircleAll(attackZone.transform.position, range, cableLayer);
        PrimManager  pm     = FindObjectOfType <PrimManager>();

        if (pm != null && cables.Length != 0)
        {
            pm.setCableToActive(cables[0].gameObject);
            pm.tryAristaActivation(cables[0].GetComponent <Cable>().arista);
        }
        //Para el graviton de Arcaelum
        Collider2D[] graviton = Physics2D.OverlapCircleAll(attackZone.transform.position, range, gravitonLayer);
        for (int i = 0; i < graviton.Length; i++)
        {
            Debug.Log("Deflecting");
            graviton[i].GetComponent <GravitonArcaelum>().deflect();
        }
        //Para el daño a Arcaelum
        Collider2D[] arc = Physics2D.OverlapCircleAll(attackZone.transform.position, range, arcLayer);
        for (int i = 0; i < arc.Length; i++)
        {
            arc[i].GetComponent <Arcaelum>().drainLife(attackPower);
        }
    }
Beispiel #4
0
        /// <summary>
        /// Loads content and and game logic.
        /// </summary>
        protected override void LoadContent()
        {
            // The primitive manager and spritebatch is loaded.
            primManager = new PrimManager(this, Content.Load <Effect>("Texts/WorldEffect"));
            spriteBatch = new SpriteBatch(GraphicsDevice);

            // Loads textures and fonts.
            textureManager.LoadTexturesFromFile("textureinfo", Content);
            FontMain = Content.Load <SpriteFont>("Fonts/FontMain");
            FontTiny = Content.Load <SpriteFont>("Fonts/FontTiny");

            // ---- GAME SPECIFIC INITALIZATIONS ----
            room = new Room(this, "blockset1", "plateau1");
            screenManager.AddScreen(new LevelEditor(this));
            cubeManager.AddCube(new Player(new Vector3(3, 3, 5), new PlayerAI(), textureManager.AniDic["player"]));
            cubeManager.AddCube(new PushCube(new Vector3(4, 3, 5), textureManager.TilesetList[0].Tiles[1]));

            // Places the light.
            primManager.myEffect.PlaceLightUsingDirection(this, 16);
            primManager.myEffect.UpdateShadowMap(this);
        }
Beispiel #5
0
 private void Start()
 {
     isPushed    = false;
     myRender    = GetComponent <SpriteRenderer>();
     primManager = FindObjectOfType <PrimManager>();
 }