DemoProductions / shmup

3 stars 2 forks source link

Prevent TrackingAI from targeting self / parent #64

Closed flip40 closed 8 years ago

flip40 commented 8 years ago

Add code to remove itself and it's parent from the local target list (be sure not to remove from the static class target list). Parent needs to be set by weapon (which might also have such a variable be set by its parent? Not sure if we have cases where the weapon would not actually be a child of the parent object and thus need this in a variable instead of just this.transform.parent). Allow for parent to be null (if we want a case for healing drones I think we just add a target type of parent that handles this case, not friendly).

Self tracking currently occurs when TrackingAI target type is set to friendly. Real use case for friendly would be targeting allies with a healing beam or something. As mentioned above, cases for a drone that heals yourself would best be covered by adding a target type other than friendly (such as parent).

flip40 commented 8 years ago

Not sure whether or not to answer the question that appears to have been removed or isn't showing up since the email, but if a projectile were to be set as a child of whoever shot it, it would also end up having it's position be relative to the parent, which we don't want.

flip40 commented 8 years ago

Oh, I guess I should have clarified in the original post that the class should have its own parent variable for keeping track of the parent object, not transform.parent (due to the reasons in the last reply).

ghost commented 8 years ago

78