Blender 3d Assets

In these days i started to design some assets for one of my games, is not a chess game, but something similar with other kind of dinamics, anyway i really like the result i hope you too.

pawn

Anuncios

Pattern Design: Inversion of Control / Dependency Injection

The Design Patterns are tools that every developer nees to know to achieve better results in their software products.

One of the most important patterns we can use to decouple our classes are Inversion of Control and Dependency Injection. This principle is use in almost every framework we know, Spring for example, but is good to know it, even if we dont use any frameworks.

“Dependency Injection (DI) is a design pattern that strive to reduce the dependency between components. Dependency Injection is often referred as Inversion of Control (IoC). In fact dependency injection is an application of the Inversion of Control principle.”

A class that depends from an other object, receive the reference of the dependent object from the outside world instead of create the instance itself.

aplicadodip

This is a good example of Inversion of Control, intead the control depends of the Lamp, this will depends of the Interface. with this pattern we invert the control of the model, no longer the control will depend of the lower modules, now it will depends of the interfaces.

image

Here we got a more complete example, now a Car will depends of objects that implement the IEngine Interface use, will not depends of objects from NormalEngine or TurboEngine Class, with this aproach we can get a decouple implementation.

Sources: http://www.lm-tech.it

http://www.dotnettricks.com

 

Connection Java with AppHarbour & MySql

In this day i want to share your with how to use the service provide by AppHarbour to connect with a Java App.

“AppHarbor is a fully hosted .NET Platform as a Service. AppHarbor can deploy and scale any standard .NET application to the cloud.” as it declare in their site: http://appharbor.com

Sin título3

In the site we can use some services for free like a databases in Mysql, MongoDB and SQL Server, but there are a lot of services, there is a free option to use for which is ideal for learning and test the technology.

I try it with Java using it in Jsp pages, to test one of my apps and it works great.

The first thing we need to do is open an account, later create an application and add then install some add-ons, in my case i install a mysql database.

Here is a screenshot of my DB and App. Sin título2

There we can see all what we need to connect with the database in our apps.

Then in our Java Proyect we only need to put the information correctly:

conn= DriverManager.getConnection(“jdbc:mysql://Hostname/Database“, “Username“, “Password“);

Take a special care to put the database data otherwise we cannot connect to the DB.

Sin título3

The best of this service is that we dont need to install another database application in our system and we can test our apps in several enviroments.

I hope this can be usefull for you. See ya and Happy Coding!!!

 

Dev-Training: Unity Test Tool & Test Runner

Sin título.png

One of the best addition in Unity is the test tools, (in older versions you will need to install it from the asset store) now you need only to go to the windows sectin and click in Test Runner

Here is a simple code for test classes in unity with that tool.

Training-Dev Js+CSS (Section 15): Color RBG Game – How to Generate a Random Color Array

Sin título3


function generateRandomColors(size){
var coloramount= size+1;
var colorR;
var colorG;
var colorB;
var colorFinal;
var colors=[];
for(var i=0; i<size; i++){
colorR=Math.floor(Math.random()*256);
colorG=Math.floor(Math.random()*256);
colorB=Math.floor(Math.random()*256);
colorFinal="rgb("+ colorR +", " + colorG +", " + colorB +")";
colors.push(colorFinal);

}
console.log(colors);
return colors;
}

 

Unity + XML + Doxygen + Graphviz: Documentation and Views

Sometimes is good to have a good documentation in a proyect specially if you restart a proyect after several month of doing other things, so here is a quick guide, maybe you will need it some day.

XML: In front of any item (class, variable, method, etc), just type “///”. The editor will fill in an XML template and attempt to auto-document the item. You can adjust the comments however you want.

Doxygen: install Doxygen and Jacob Pennock’s Doxygen Unity integration.

Graphviz: install it, after that you need to choose with options do you will need in your proyect, editing the Doxygen file of your proyect.

Configure DOT and Doxygen: The best way to configure, is with the Doxygen GUI frontend:

Start → Programs → doxygen → doxywizard

Click “Expert…” in the Doxygen Wizard and select the tab “Dot”.
Here you need to tell Doxygen that Graphiz has been installed and the path to Graphviz.
Select “HAVE_DOT” and enter the path to the Graphiz binaries.

Sin título3

In the wizard we can configure the options we will need in the proyect.

Remember to add the DOT_PATH and then only runn the program in the RUN seccion of the wizard.

The Result will be something like this:

Sin título2

Sin título

Dev-Training 8-21: Unity – Triggers

Sin título

When the ball enter in the pinSetter box the letter change the color, and the pins are delete

void OnTriggerEnter(Collider other){
     if (other.gameObject.GetComponent<Ball>()) {
           pinText.color = Color.red;
          _ballEnteredBox = true; }
}

 

Always when we use trigger we need 2 things:

1- Collider

2- Check the box “Trigger”

Sin título

 

 

Subir ↑