Basically, I have made:
- a parent class for behaviors "CreatureBehavior"
- a child class for a builder npc "BuilderBehavior", which inherits from "CreatureBehavior"
- a function inside "BuilderBehavior" for building roads BuildRoad().
- a child class for a builder npc of a specific race "CirclerBuilderBehavior", which inherits from "BuilderBehavior" (He'll build different things than other builder races)
- an override in the class "CirclerBuilderBehavior" for the BuildRoad() function
The problem is that if I declare a variable "behavior" of type "CreatureBehavior", the main parent class, even if i use "behavior = new CirclerBuilderBehavior()" I cannot access the function BuildRoad() that I declared in the first child class since "it's not declared in the parent class CreatureBehavior".
The goal is not to declare the function BuildRoad() in the parent class "CreatureBehavior", because if I happen to make a behavior child class for bears, for exemple, I don't plan on making the bears build roads...
![alt text][1]
![alt text][2]
[1]: /storage/temp/204216-capture6.png
[2]: /storage/temp/204217-capture7.png
↧
Trending Articles
More Pages to Explore .....